Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBuild.Community.Tasks issue with vs2017

Folks I've a set of services first created in 2012, which - down the years - have seamlessly built with Vs2010, Vs2013 & Vs2015.

When I try to build with Vs2017 I get

The MSBuild.Community.Tasks.Attrib task could not be loaded from the assembly The assembly lives under the C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\MSBuildCommunityTasks folder, however there is no MSBuildCommunityTasks folder under the \2017\Professional\MSBuild folder.

Here's the full error

C:\working\MySolution\build\Build.proj" (default target) (1) ->
(SetAssemblyVersion target) ->
  C:\working\MySolution\build\Build.proj(100,5): error MSB4062: The "MSBuild.Community.Tasks.Attrib" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll. 
  Could not load file or assembly 'file:///C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.dll' or one of its dependencies. 
  The system cannot find the file specified. Confirm that the <UsingTask> 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.

What changed between Vs2015 and Vs2017?
What do I need to do to fix this?

like image 867
Binary Worrier Avatar asked Apr 07 '17 15:04

Binary Worrier


2 Answers

The extensions are most likely installed in 'C:\Program Files (x86)\MSBuild'. So I currently set the variable explicitly in my proj as a workaround.

<MSBuildExtensionsPath>C:\Program Files (x86)\MSBuild</MSBuildExtensionsPath>
like image 148
Denxorz Avatar answered Oct 17 '22 05:10

Denxorz


Explicitly setting the MSBuildCommunityTasksPath property gets past the problem.

I do this at the top of my build.proj file.

(For historic reasons we keep the community build tasks in our repo, which is why it's set to a location under trunk)

<MSBuildCommunityTasksPath>$(trunk)\Ref\Build\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
like image 3
Binary Worrier Avatar answered Oct 17 '22 04:10

Binary Worrier