You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 19:37:53