Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoiding local dependencies for MSBuild Community Tasks within Visual Studio 2010

I'm trying to start taking advantage of the MSBuild Community Tasks so right after installing the .msi package I've imported MSBuild.Community.targets within the <Project> element this way:

<Import Project="lib\MSBuild.Community.Tasks.targets" />

Interestingly I've noticed such file have a reference to the local installation path in MSBuildExtensionsPath and given that in lieu of keeping code dependencies as clean as possible I'm willing to pay the overhead of distributing/versioning them with every project, I was wondering if is it possible to sort of override the default/installation location with a project-relative one in the .cproj file?

The actual layout would be like:

Dotnet.Samples.Foobar
\src
     Foobar.cs
\lib
     MSBuild.Community.Tasks.targets
     MSBuild.Community.Tasks.dll

Any guidance will be sincerely appreciated. Thanks much in advace for any suggestion you might want to share.

like image 376
Nano Taboada Avatar asked Apr 10 '11 20:04

Nano Taboada


1 Answers

In MSBuild.Community.Tasks.targets specified the path to the dll.

<PropertyGroup>
  <MSBuildCommunityTasksPath Condition="'$(MSBuildCommunityTasksPath)' == ''">$(MSBuildExtensionsPath)\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
  <MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
</PropertyGroup>

You can override the path in the project.

<PropertyGroup>
   <MSBuildCommunityTasksPath>lib</MSBuildCommunityTasksPath>      
</PropertyGroup>

And leave import the same:

<Import Project="lib\MSBuild.Community.Tasks.targets" />
like image 177
Sergio Rykov Avatar answered Oct 22 '22 05:10

Sergio Rykov