Wix - 在 .wixproj 上使用 WixVariables

Wix - Use WixVariables on .wixproj

我在 Visual Studio 2012 年,我使用 wix

我想在卸载项目时在生成后目标 (wixproj) 上使用 WixVariables 或 DefineConstants

我用在

<DefineConstants>VersionNodeServer=0.0.1;</DefineConstants>

<WixVariables>VersionNodeServer=0.0.1;</WixVariables>

但是当我像那样使用这个变量时 'VersionNodeServer'

<Target Name="AfterBuild">
<WebDownload FileName="test.msm" FileUri="$(VersionNodeServer)"/>

构建失败,因为 FileUri 为空。

我在 VS 控制台上看到了我的变量..

C:\Program Files\WiX Toolset v3.10\bin\candle.exe -dDebug -dVersionNodeServer=0.0.1;[...]

<DefineConstants><WixVariable> 都没有为 MSBUILD 定义变量。你必须把

 <PropertyGroup>
    <VersionNodeServer>0.1.1</VersionNodeServer>
 </PropertyGroup>

在您的 .wixproj 文件中的某处。