如何在不执行构建的情况下检索@(TargetOutputs) [英] How to retrieve @(TargetOutputs) without performing a build
问题描述
我正在实现一个MSBuild框架,以驱动许多按层次结构组织的项目的构建和部署.
I'm implementing an MSBuild framework to drive the building and deployment of many projects organized as a hierarchy.
<Target Name="_CoreBuild">
<MSBuild Projects="@(Project)" Targets="Build" Properties="Configuration=$(Configuration)">
<Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" />
</MSBuild>
</Target>
为了实现适当的Clean/Clobber逻辑,我想检索如果使用当前选项执行构建将要编译的文件列表.
In order to implement proper Clean/Clobber logic, I would like to retrieve the list of files that would be compiled if a build were performed with the current options.
<Target Name="_CoreClobber" DependsOnTargets="_CoreClean">
<!-- How to retrieve @(CompiledAssemblies) as if we were
building @(Project) and retrieving the @(TargetOutputs) item group.
-->
</Target>
我尝试了各种方法,包括创建一个自定义任务,在其中构建一个自定义项目文件,该文件导入要从中检索属性/项目的原始项目.但这并不能给我可靠的价值.
I've tried various methods, including creating a custom task, in which I build a custom project file that imports the original project I want to retrieve the properties/items from. But that does not give me reliable values.
是否可以在不实际执行构建的情况下检索MSBuild项目的TargetOutputs项目组?
Is there a way to retrieve an MSBuild project's TargetOutputs item group without actually performing a build?
推荐答案
没关系.
我偶然发现了以下类似问题,并认为我必须使用GetTargetPath
目标,就像这样:
I stumbled upon the following similar question, and figured I had to use the GetTargetPath
target, like so:
<Target Name="_CoreBuild">
<MSBuild Projects="@(Project)" Targets="GetTargetPath" Properties="Configuration=$(Configuration)">
<Output TaskParameter="TargetOutputs" ItemName="CompiledAssemblies" />
</MSBuild>
</Target>
这篇关于如何在不执行构建的情况下检索@(TargetOutputs)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!