Jax
Jax

Reputation: 1843

EntityFrameworks.dll file missing?

I am totally new to the .NET world and been trying to build an MVC application following this tutorial, creating a database first then creating an MVC project on top of it and whenever I create the Models from the existing db I get a number of errors like this:

Error 1 Compiling transformation: Metadata file '%VS120COMNTOOLS%..\IDE\EntityFramework.dll' could not be found c:\users\j\desktop\visual studio 2013\Projects\ContosoSite\ContosoSite\Models\ContosoModel.tt

And this one also:

Error 2 Compiling transformation: Metadata file '%VS120COMNTOOLS%..\IDE\Microsoft.Data.Entity.Design.dll' could not be found c:\users\j\desktop\visual studio 2013\Projects\ContosoSite\ContosoSite\Models\ContosoModel.tt

I have Entity Frameworks installed (version 6.1)

after hours of googling and searching for answers apparently there is a(or many) file(s) missing (dll?) in my Windows 8.1 OS.

Has anyone come up with a solution for this?

J

Upvotes: 7

Views: 21778

Answers (3)

Arash Ghasemi Rad
Arash Ghasemi Rad

Reputation: 314

I had same problem with VS2019. I shared my experience here.

The file that needs to be edited is in the “C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes” directory. The file you want to edit (assuming you are using EF6 and C#) is called EF6.Utility.CS.ttinclude. If you edit that file and replace “$(VSAPPIDDIR)EntityFramework.dll” with the full path to “…\Common7\IDE\EntityFramework.dll” (and similarly for the other reference to VSAPPIDDIR) then you should be good to go.

Upvotes: 0

Jax
Jax

Reputation: 1843

Followed the steps as per this stackoverflow, rebuilt the Models from the db and voila! All Sorted

Credit to @Jaon

  1. Check your install location. I installed VS to the other location D:\ than default C:\ so I got the error.
  2. modify "Environment Variables" to your location, for me it means changing C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\ to D:\Microsoft Visual Studio 12.0\Common7\Tools.
  3. DON'T Forget to add a \ to the end of word.

Upvotes: 4

Sreeraj
Sreeraj

Reputation: 2434

The project in the example uses the help of a library called "Entity Framework" to help with database queries. In Visual Studio these libraries are installed as Nuget Packages. For more info about Nugets, check this link

In order to install this library follow these steps in your Visual Studio IDE. Go to Tools>Package Manager Console>Package Manager Console. When the console opens up, type "Install-Package EntityFramework" and hit enter key. This will install Entity Framework Nuget Package to your IDE. Then you can use this library by adding a using reference.

Upvotes: 2

Related Questions