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


Question

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.

Accepted Answer

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.


Popular Answer

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" />




Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why