在Visual Studio 2010中避免使用MSBuild Community Tasks的本地依赖

6
我想开始利用MSBuild Community Tasks,所以在安装了.msi包之后,我导入了MSBuild.Community.targets<Project>元素中,方法如下:
<Import Project="lib\MSBuild.Community.Tasks.targets" />

有趣的是,我注意到这样的文件在MSBuildExtensionsPath中引用了本地安装路径,并且考虑到保持代码依赖尽可能干净,我愿意承担分发/版本化每个项目的开销。我想知道是否可以在.cproj文件中使用相对于项目的位置来覆盖默认/安装位置?

实际布局将如下所示:

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

任何指导将不胜感激。非常感谢您愿意分享的任何建议。
1个回答

7
MSBuild.Community.Tasks.targets 中指定了 dll 的路径。
<PropertyGroup>
  <MSBuildCommunityTasksPath Condition="'$(MSBuildCommunityTasksPath)' == ''">$(MSBuildExtensionsPath)\MSBuildCommunityTasks</MSBuildCommunityTasksPath>
  <MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
</PropertyGroup>

您可以覆盖项目中的路径。

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

并且保持导入方式不变:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接