问题描述
在干净的 Windows 重新格式化并安装 Visual Studio 2013 后,尝试使用数据库优先的实体框架 edmx 文件构建项目会产生以下错误:
After a clean Windows reformat and installing Visual Studio 2013, trying to build a project with database-first Entity Framework edmx files yields the following error:
无法从程序集中加载EntityDeploySplit"任务C:程序文件(x86)MSBuild12.0inMicrosoft.Data.Entity.Build.Tasks.dll.可以不加载文件或程序集 'file:///C:Program Files(x86)MSBuild12.0inMicrosoft.Data.Entity.Build.Tasks.dll' 或一个它的依赖关系.该系统找不到指定的文件.确认声明正确,组装并且它的所有依赖项都可用,并且该任务包含一个实现 Microsoft.Build.Framework.ITask 的公共类.
有什么办法可以单独安装吗?这个程序集默认包含什么?
Is there some way to install this separately? What is this assembly included with by default?
更新:这也体现在寻找 EntityClean 任务时.我倾向于认为它首先检查垃圾箱,因为另一个运行良好的开发人员尝试了清理/重建,然后这开始出现.
UPDATE: This also manifests itself when looking for the EntityClean task. I'm inclined to think that it checks the bin first, since another developer who was running it fine tried a clean / rebuild and then this started showing up.
推荐答案
我遇到了这个问题,并且能够按照我下面的描述修复它.您的路径和变量可能不同.
I ran into this problem and was able to fix it as I have described below. Your paths and variables may be different.
我发现当我的项目构建时它指向这个目标文件:
I found that when my project builds it points to this target file:
C:Program Files (x86)MSBuild12.0BinMicrosoft.Data.Entity.targets
那个目标文件似乎只是一个占位符.该文件中有一个 Import 元素,它指向 $(MSBuildFrameworkToolsPath)Microsoft.Data.Entity.targets
,它运行位于该路径的目标文件.我搜索了注册表,发现 MSBuildFrameworkToolsPath
是一个注册表项,其值为 C:WindowsMicrosoft.NETFrameworkv4.0.30319
That target file appears to just be a placeholder. There is an Import element, in that file, that points to $(MSBuildFrameworkToolsPath)Microsoft.Data.Entity.targets
which runs the target file located at that path. I searched registry and found that MSBuildFrameworkToolsPath
is a registry entry with the value of C:WindowsMicrosoft.NETFrameworkv4.0.30319
我转到引用的目标文件并搜索在我的异常中指定的 UsingTask
元素.在 UsingTask
元素中,AssemblyFile
属性指向 $(MSBuildBinPath)Microsoft.Data.Entity.Build.Tasks.dll
.我搜索了注册表,发现 MSBuildBinPath 注册表项指向 c:WindowsMicrosoft.NETFrameworkv3.5
I went to the targets file that was referenced and search for the UsingTask
element that was specified in my exception. Inside the UsingTask
element, the AssemblyFile
attribute was pointed to $(MSBuildBinPath)Microsoft.Data.Entity.Build.Tasks.dll
. I searched the registry and found that the MSBuildBinPath registry entry was pointed to c:WindowsMicrosoft.NETFrameworkv3.5
我不知道为什么会指向那个,可能是 Framework 或 Visual Studio 安装没有清理它.最后,我将所有 UsingTask
元素的 AssemblyFile
属性更改为:
I'm not sure why it was pointed to that, maybe a Framework or Visual Studio installation didn't clean it up. Finally, I changed all my UsingTask
elements' AssemblyFile
attributes to:
$(MSBuildFrameworkToolsPath)Microsoft.Data.Entity.Build.Tasks.dll
我使用了 MSBuild Bin 目标文件中的相同变量.
I used the same variable that was in the MSBuild Bin target file.
希望这会有所帮助.
这篇关于EntityDeploySplit 错误 - Microsoft.Data.Entity.Build.Tasks.dll 丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!