gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 18:49:51 26 4
gpt4 key购买 nike

我正在实现一个 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>

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

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

最佳答案

没关系。

我偶然发现 the following similar question ,并认为我必须使用 GetTargetPath目标,像这样:

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

关于msbuild - 如何在不执行构建的情况下检索@(TargetOutputs),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7823975/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com