如何在MSBuild 17中获取引用项目的生成输出目录?
在MSBuild 17环境下获取引用项目的生成输出目录
在MSBuild 17环境中,若当前项目(例如Installer.wixproj)引用了其他项目(例如Ref.csproj),可通过如下方式获取被引用项目的生成输出目录:
示例项目配置(Installer.wixproj)
<!-- Installer.wixproj --> <Project Sdk="WixToolset.Sdk/4.0.0"> <ItemGroup> <ProjectReference Include="..\Ref\Ref.csproj" /> </ItemGroup> <Target Name="ShowProject" AfterTargets="Build"> <Message Text="Output path is $(Ref.OutputDir)" Importance="high" /> </Target> </Project>
执行构建命令
dotnet build Installer.wixproj
预期输出
MSBuild version 17 ... Output path is C:\Path\To\Solution\Ref\bin\Release
内容的提问来源于stack exchange,提问作者Jeremy Morren
相关产品推荐
相关产品推荐

