6

在以这种方式安装我在元素中导入的包后,我正在尝试开始利用MSBuild Community Tasksso :.msiMSBuild.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

任何指导将不胜感激。非常感谢您可能想要分享的任何建议。

4

1 回答 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" />
于 2011-04-12T10:15:28.737 回答