如何在不执行构建的情况下检索@(TargetOutputs)
我正在实现一个 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 项组?
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>
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.
Is there a way to retrieve an MSBuild project's TargetOutputs item group without actually performing a build?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没关系。
我偶然发现以下类似问题,并认为我必须使用
GetTargetPath
目标,如下所示:Never mind.
I stumbled upon the following similar question, and figured I had to use the
GetTargetPath
target, like so: