Visual Studio .csproj 文件有一个“TargetFramework”变量

And*_*erd 5 wix csproj visual-studio

我将一些 .csproj 文件从旧格式更新为新的 .csproj 格式,以便能够提供多个目标框架。

这破坏了 wix 安装程序构建器,因为 TargetPath 变量不再可用。我在这里实现了解决方法:https ://github.com/wixtoolset/issues/issues/5705

    <Target Name="GetTargetPath" Returns="@(_Net40OutputPath)">
        <ItemGroup>
            <_Net40OutputPath Include="$(MSBuildProjectDirectory)\$(PackageOutputPath)\net40\$(AssemblyName).dll" />
        </ItemGroup>
    </Target>
Run Code Online (Sandbox Code Playgroud)

您可以看到我对除 之外的每个值都使用了变量TargetFramework。我被迫进行硬编码,net40因为我不知道可以使用的变量。

有没有办法完全通过变量来确定项目的输出路径?