Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

The "EntityDeploySplit" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Data.Entity.Build.Tasks.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Data.Entity.Build.Tasks.dll' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Is there some way to install this separately? What is this assembly included with by default?

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.

like image 433
Brandon Linton Avatar asked Dec 05 '13 12:12

Brandon Linton


3 Answers

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" />
like image 128
Jamie Ide Avatar answered Nov 13 '22 20:11

Jamie Ide


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.

like image 38
Andy Mahaffey Avatar answered Nov 13 '22 21:11

Andy Mahaffey


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')"/>
like image 1
Troy Avatar answered Nov 13 '22 19:11

Troy