I get a rather unusual error in Visual Studio 2013 in Visual Basic when trying to work with Entity Framework. This doesn't matter whether I work with an existing project or create a new one. It started to happen when I changed to a new PC with Win 8.1.
I create a new model using the wizard from a database. It creates the diagram very nicely. However, I get an compilation error telling the library EntityFramework.dll
doesn't exist. However, the only thing is that the path to EntityFramework.dll
is wrong (Looks like: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\..\IDE\EntityFramework.dll
). The address, however, would be D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
. Where would I change that value?
Ueli
Apparently when reinstalling Visual Studio to a different drive the %VS120COMNTOOLS%
environment variable is not updated correctly and points to the folder on the drive where VS was originally installed. The template for generating DDL SQL is using the %VS120COMNTOOLS%
environment variable to find assemblies it needs to generate the code. Since the variable is pointing to a folder that no longer contains the necessary files the T4 template transformation fails.
Troubleshooting:
set the variable manually to point to the correct location (e.g.
set VS120COMNTOOLS="D:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\"
)
devenv
(Note that if you follow the above steps to set the variable it will only work for VS instances started from this command prompt.)
If the above works go to the computer properties (e.g. in Win 8/Win 8.1 type "This PC" in the search window), right click on the icon and select "Properties", go to the "Advanced" tab and click the "Environment Variables" button, then in the "System variables" window find the VS120COMNTOOLS
variable, double click (or click the "Edit" button) and fix the variable so that it points to the right folder.
Don't forget the last backslash after Tools... C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools <---- will not work, but... C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\ <--- will work
It might look funny but I encounter the same issue (with windows 8.1) but none of the suggested methods worked for me!! I checked my environment variables it had the correct path but when I tested it with explorer (typed %VS120COMNTOOLS% in explorer's address bar) it does not showed up!! Rather it said "windows cannot find %VS120COMNTOOLS% make sure you typed the name correctly" So what I did was I just deleted the variable and recreated it with the exact same path and after rebuild the error gone!!!
So if you guys have the same issue give it a go
In my case, it was a permission issue and not related to the environment variable file path as the path was correct in my case.
So what I did is added permissions to my current user on the whole visual studio installation folder and then launched Visual Studio as administrator. I re-generated my Model and it worked!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With