EntityDeploySplit error - Microsoft.Data.Entity.Build.Tasks.dll missing

后端 未结 4 592
走了就别回头了
走了就别回头了 2020-12-29 12:30

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:

相关标签:
4条回答
  • 2020-12-29 13:01

    I found the accepted answer to be a little confusing, below are the steps that worked for me.

    Open C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.targets in notepad.

    Alter the UsingTask elements to:

      <UsingTask TaskName="EntityDeploySplit"
                 AssemblyFile="Microsoft.Data.Entity.Build.Tasks.dll" />
    
      <UsingTask TaskName="EntityDeploy"
                 AssemblyFile="Microsoft.Data.Entity.Build.Tasks.dll" />
    
      <UsingTask TaskName="EntityDeploySetLogicalNames"
                 AssemblyFile="Microsoft.Data.Entity.Build.Tasks.dll" />
    
      <UsingTask TaskName="EntityClean"
                 AssemblyFile="Microsoft.Data.Entity.Build.Tasks.dll" />
    
    0 讨论(0)
  • 2020-12-29 13:06

    In my case, I had accidentally created two copies of one of my .edmx files, one in a subfolder, where I didn't notice it. Once I deleted the extra one, everything was fine.

    0 讨论(0)
  • 2020-12-29 13:07

    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)\MSBuild\12.0\Bin\Microsoft.Data.Entity.targets
    

    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:\Windows\Microsoft.NET\Framework\v4.0.30319\

    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:\Windows\Microsoft.NET\Framework\v3.5\

    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

    I used the same variable that was in the MSBuild Bin target file.

    Hope this helps.

    0 讨论(0)
  • 2020-12-29 13:13

    I give a lot of credit to Andy Mahaffey for his answer, without it I would not have found what I did. I followed along his line of research but didn't like the idea of just changing the UsingTasks' attributes. I opened up the "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Data.Entity.targets" file and I found the first thing it says after the opening Project element is this comment:

      <!-- 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')"/>
      -->
    

    I followed it's suggestion and presto, problems solved.

    I hope this helps!

    TLDR

    Paste the line below as the last element before the tag in the following file. 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')"/>
    
    0 讨论(0)
提交回复
热议问题