如何在不执行构建的情况下检索@(TargetOutputs)

Max*_*lle 5 msbuild itemgroup

我正在实现一个MSBuild框架来驱动构建和部署作为层次结构组织的许多项目.

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

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

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

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

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

Max*_*lle 6

没关系.

我偶然发现了以下类似的问题,并认为我必须使用GetTargetPath目标,如下所示:

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