【问题标题】:The "EntityClean" task could not be loaded from the assembly, Visual Studio 2012无法从程序集加载“EntityClean”任务,Visual Studio 2012
【发布时间】:2013-05-28 15:47:50
【问题描述】:

我已将 VS2010 项目文件导入 VS2012。虽然导入成功,但我尝试构建解决方案时出现以下错误:

错误 3 无法从程序集 c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.Build.Tasks.dll 加载“EntityClean”任务。无法加载文件或程序集 'file:///c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.Build.Tasks.dll' 或其依赖项之一。该模块应包含程序集清单。确认声明正确,程序集及其所有依赖项都可用,并且任务包含实现 Microsoft.Build.Framework.ITask 的公共类。 DefinitiveHC.数据

项目在 VS2010 和 VS2012 中都针对框架 4.0。

关于我如何解决这个问题的任何线索?

【问题讨论】:

    标签: visual-studio entity-framework msbuild


    【解决方案1】:

    我在研究时发现了你的问题,所以我想我也会在这里回答。我在this other question 中找到了一个答案,这让我走上了正确的道路,我认为可能是一个更好的答案(详见下文)。

    我非常感谢Andy Mahaffey's answer,没有它我不会找到我所做的事情。 我遵循他的研究方向,但不喜欢仅更改 UsingTasks 属性的想法。我打开了“C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.targets”文件,我发现它在打开项目元素后说的第一件事就是这个注释:

      <!-- This .targets file can be used by updating Microsoft.Common.targets to 
             include the line below (as the last import element just before the end project tag)
          <Import Project="$(MSBuildBinPath)\Microsoft.Data.Entity.targets" Condition="Exists('$(MSBuildBinPath)\Microsoft.Data.Entity.targets')"/>
      -->
    

    我听从了它的建议,很快问题就解决了。

    我希望这会有所帮助!

    TLDR

    将下面的行粘贴为以下文件中标记之前的最后一个元素。 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets

    <Import Project="$(MSBuildBinPath)\Microsoft.Data.Entity.targets" Condition="Exists('$(MSBuildBinPath)\Microsoft.Data.Entity.targets')"/>
    

    【讨论】:

      【解决方案2】:

      这是您在错误列表窗口中看到的内容。要查看实际问题,请打开输出窗口以查看实际问题。要解决,请执行以下操作:

      • 导航到“C:\Windows\Microsoft.NET\Framework\v4.0.30319”。
      • 复制Microsoft.Data.Entity.Build.Tasks.dll
      • 将此粘贴​​到位置“C:\Program Files (x86)\MSBuild\12.0\Bin

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-12-09
        • 2016-01-13
        • 2018-02-10
        • 2013-11-25
        • 2023-03-03
        • 2018-12-12
        相关资源
        最近更新 更多