Metadata file not found - Data.Entity.Model

2019-01-11 23:07发布

Anyone having similar problem, while creating webservices?

Compiling transformation: Metadata file 'D:\Program Files\VS2013\Common7\Tools..\IDE\Microsoft.Data.Entity.Design.dll' could not be found D:\PROJEKTY\apki\ws2\WS\WS\DataModel.tt

error screenshot

I tried adding data model again, restarting VS, cleaning and building solution, creating new project, deleting and adding reference, installing the newest version. I think that any solution found on internet does not work for me.

Any suggestions? I think of pasting file into this directory, but can't think what may be there.

7条回答
乱世女痞
2楼-- · 2019-01-11 23:38

Based on

C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude

, the code generator is looking for the missing DLLs in the following locations:

<#@ assembly name="%VS120COMNTOOLS%..\IDE\EntityFramework.dll" #>
<#@ assembly name="%VS120COMNTOOLS%..\IDE\Microsoft.Data.Entity.Design.dll" #>

I discovered that the environment variable %VS120COMNTOOLS% is not compatible with the correct installation path of visual studio, so I changed it from Advanced system properties and it worked

查看更多
劫难
3楼-- · 2019-01-11 23:43

I believe VS is not updating the VS120COMNTOOLS variable correctly when reinstalling VS to a different drive. See this SO thread for an extended answer.

查看更多
爷的心禁止访问
4楼-- · 2019-01-11 23:43

This worked for me.

  1. Go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF6.Utility.CS.ttinclude

  2. Edit it with Visual Studio.

  3. Remove the two dots after the URL, so the new lines like:

    <#@ assembly name="%VS120COMNTOOLS%\IDE\EntityFramework.dll" #>
    <#@ assembly name="%VS120COMNTOOLS%\IDE\Microsoft.Data.Entity.Design.dll" #>
    
  4. Fix your environment variables to end with directory just befor IDE. In my case

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\
    
  5. Rebuild the project or delete the entity framework and recreate it.

查看更多
看我几分像从前
5楼-- · 2019-01-11 23:45

The problem lies in the fact that the file originally EF6.Utility.CS.ttinclude wrong. Even if the variable %VS120COMNTOOLS% is the correct value, the error still occurs.

Blame the two stupid points in the following lines (%VS120COMNTOOLS%..\IDE):

<#@ assembly name="%VS120COMNTOOLS%..\IDE\EntityFramework.dll" #>
<#@ assembly name="%VS120COMNTOOLS%..\IDE\Microsoft.Data.Entity.Design.dll" #>

If that's the way to fix the error no longer occurs:

<#@ assembly name="%VS120COMNTOOLS%\IDE\EntityFramework.dll" #>
<#@ assembly name="%VS120COMNTOOLS%\IDE\Microsoft.Data.Entity.Design.dll" #>

And the variable %VS120COMNTOOLS% must have the correct value, of course.

The question is old, but the answer is still relevant now, because this error persists, and in the VS2015. Below lines from the ill-fated file:

<#@ assembly name="%VS140COMNTOOLS%..\IDE\EntityFramework.dll" #>
<#@ assembly name="%VS140COMNTOOLS%..\IDE\Microsoft.Data.Entity.Design.dll" #>

Sorry.

查看更多
叛逆
6楼-- · 2019-01-11 23:45

Try this:

  1. Double Click on the .edmx Model
  2. Right click anywhere on the "Entity Data Model Designer"
  3. Click "Update Model from Database"
  4. Click Finish
查看更多
Animai°情兽
7楼-- · 2019-01-11 23:48
  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.
查看更多
登录 后发表回答