本文介绍了是否可以不安装就使用MSBuild Extension Pack?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以将MSBuild Extension Pack与本地"引用一起使用,而无需您运行安装程序?换句话说,您是否可以将目标存储在解决方案项目文件夹中,以便每个开发人员都不必安装目标?

Is there a way to use the MSBuild Extension Pack with a "local" reference that doesn't require you to run the installer? In other words, can you store the targets in a solution items folder so that every developer doesn't have to install it?

推荐答案

您必须在任务的导入语句之前声明属性 ExtensionTasksPath .例如看一下:

You have to declare the property, ExtensionTasksPath, before the import statment for the tasks. For example take a look at:

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ExtensionTasksPath Condition="'$(ExtensionTasksPath)' == ''">E:\Data\Development\My Code\Community\MSBuild\ExtensionPack\</ExtensionTasksPath>
  </PropertyGroup>

  <Import Project="$(ExtensionTasksPath)MSBuild.ExtensionPack.tasks"/>

  <Target Name="Demo">
    <MSBuild.ExtensionPack.FileSystem.File TaskAction="GetTempFileName">
      <Output TaskParameter="Path" PropertyName="TempPath"/>
    </MSBuild.ExtensionPack.FileSystem.File>

    <Message Text="TempPath: $(TempPath)" />
  </Target>

</Project>

MSBuild社区任务相似,但属性名为 MSBuildCommunityTasksLib .我认为对于SDC任务,其名为 TasksPath .

The MSBuild Community tasks is similar but the property is named MSBuildCommunityTasksLib. I think for SDC tasks its called TasksPath.

这篇关于是否可以不安装就使用MSBuild Extension Pack?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 15:51