我在 Visual Studio 2012 中有一个 Wix 安装项目,并且有一个类似的 xml 节点
<MsiPackage ... DownloadUrl="http://uat.mywebsite.com/MyMSI.msi">
我想根据构建配置更改 url。即在 uat 中,我希望它是http://uat.mywebsite.com/ ...并在发布时http://mywebsite.com/ ...
这是可能的,如果可以,我该怎么做?
我在 Visual Studio 2012 中有一个 Wix 安装项目,并且有一个类似的 xml 节点
<MsiPackage ... DownloadUrl="http://uat.mywebsite.com/MyMSI.msi">
我想根据构建配置更改 url。即在 uat 中,我希望它是http://uat.mywebsite.com/ ...并在发布时http://mywebsite.com/ ...
这是可能的,如果可以,我该怎么做?
您的 WiX 项目可以访问构建参数,例如配置 (debug
或release
)。您可以通过在组件声明中DownloadUrl
引用有条件地包含正确的当前配置:$(var.Configuartion)
没有对此进行测试,但类似的东西应该可以工作:
<?if $(var.Configuartion) = Release?>
<?define DownloadUrl = "http://uat.mywebsite.com/" ?>
<?elseif $(var.Configuartion) = Debug?>
<?define DownloadUrl = "http://mywebsite.com/" ?>
<?endif ?>
<MsiPackage ... DownloadUrl="$(var.DownloadURL)">