Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't build in visual studio 2015 because 'Microsoft.Build.Tasks.v14.0.dll' cannot be found

The assembly has been renamed. Change on the CodeTaskFactory MSBuild Task the AssemblyFile parameter to...(in your error there should be a targets file name where this task resides)

AssemblyFile="C:\Program Files (x86)\MSBuild\14.0\Bin\Microsoft.Build.Tasks.Core.dll"

Chances are someone tried to be clever and use an MSBuild property like this..(which doesn't work for MSBuild 14 but would for 12)...

AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll"

Just fyi...There are some others as well such as Microsoft.Build.Utilities.v12.0.dll has been renamed to Microsoft.Build.Utilities.Core.dll


What helped me with Visual Studio 2017 is to copy Microsoft.Build.Tasks.Core.dll and rename it to Microsoft.Build.Tasks.v15.0.dll build.tasks.v15.0.dll


In my case that was a problem of SFML.NET nuget package.

It depended upon outdated Nuget Baseclass.Contrib.Nuget.Output component, which was the reason why build failed.

After i manually updated to .Net 4.6, deleted all nuget staff from project file and deleted its files from project and readded all dependencies again version of Baseclass.Contrib.Nuget.Output was changed and viola!


First time I restart visual studio, worked for me

Second time I got this error again and I did update:

Install-Package Baseclass.Contrib.Nuget.Output -Version 2.2.0-xbuild02


It was enough for me to just restart Visual Studio.

I suspect that I had earlier killed all my MSBuild.exe processes doing something else and that not having any MSBuild.exe processes causes the error.


Following on from Gary's answer I parameterized this as follows:

<Choose>
  <When Condition="'$(MSBuildToolsVersion)'=='14.0'">
    <PropertyGroup>
      <TasksAssemblyName>Microsoft.Build.Tasks.Core</TasksAssemblyName>
    </PropertyGroup>
  </When>
  <Otherwise>
    <PropertyGroup>
      <TasksAssemblyName>Microsoft.Build.Tasks.v$(MSBuildToolsVersion)</TasksAssemblyName>
    </PropertyGroup>
  </Otherwise>
</Choose>
<UsingTask TaskName="SecondsSinceEpoch" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\$(TasksAssemblyName).dll">

My solution: removing two rows from the "*.csproj" file:

<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />