【问题标题】:How to retrieve @(TargetOutputs) without performing a build如何在不执行构建的情况下检索@(TargetOutputs)
【发布时间】:2011-10-19 15:39:52
【问题描述】:

我正在实施一个 MSBuild 框架,以推动构建和部署许多按层次结构组织的项目。

<Target Name="_CoreBuild">
  <MSBuild Projects="@(Project)" Targets="Build" Properties="Configuration=$(Configuration)">
    <Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" />
  </MSBuild>
</Target>

为了实现正确的 Clean/Clobber 逻辑,如果使用当前选项执行构建,我想检索将编译的文件列表。

<Target Name="_CoreClobber" DependsOnTargets="_CoreClean">
   <!-- How to retrieve @(CompiledAssemblies) as if we were
        building @(Project) and retrieving the @(TargetOutputs) item group.
     -->
</Target>

我尝试了各种方法,包括创建自定义任务,在其中我构建了一个自定义项目文件,该文件导入了我想要从中检索属性/项目的原始项目。但这并没有给我可靠的价值。

有没有办法在不实际执行构建的情况下检索 MSBuild 项目的 TargetOutputs 项组?

【问题讨论】:

    标签: msbuild itemgroup


    【解决方案1】:

    没关系。

    我偶然发现了the following similar question,并认为我必须使用GetTargetPath 目标,如下所示:

    <Target Name="_CoreBuild">
      <MSBuild Projects="@(Project)" Targets="GetTargetPath" Properties="Configuration=$(Configuration)">
        <Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" />
      </MSBuild>
    </Target>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-17
      • 1970-01-01
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多