WIX 安装程序中同一文件夹中的互斥文件 [英] Mutually exclusive files in the same folder in a WIX Installer

查看:22
本文介绍了WIX 安装程序中同一文件夹中的互斥文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据 WIX 项目中的用户输入将互斥应用程序部署到互斥环境中.我所做的研究告诉我我不能使用条件来做到这一点 http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/ 这似乎是一个相当普遍的问题,一个明确的最佳实践会很有价值.

I would like to deploy mutually exclusive applications into mutually exclusive environments based on User Input in a WIX project. The research I've done tells me I can't do this using conditions http://www.joyofsetup.com/2007/05/30/feature-conditions-and-ui/ This seems like a fairly common question and a definitive best practice would be valuable.

我已经使用上述文章中的功能和发布事件实现了这一点.我的 UI 中的事件如下.

I've implemented this using features and publishing events per the above article. The events in my UI are below.

在我的情况下,我将两个相互排斥的 Web 应用程序之一安装到三个不同的环境之一中.为此,我创建了 8 个功能,其中 1 个用于应用程序和除 web.config 之外的所有文件,6 个用于 web.config 文件,具体取决于正在安装的应用程序和安装到的环境.我必须在每个功能中包含一个条件以通过 ICE 验证,即使它们由下面的发布元素控制,因为它们被安装到不同服务器上名为相同的目录中.有没有更好的方法,或者这是这种情况的标准做法?

In my situation I'm installing one of two mutually exclusive web applications into one of three different environments. I did this by creating 8 features, 1 each for the applications and all files except web.config and 6 for the web.config files depending on the application being installed and the environment being installed into. I had to include a condition in each of the features to pass ICE validation even though they are controlled by publish elements below because they are being installed to a directory named the same on different servers. Is there a better way or is this the standard practice for this sort of situation?

      <Publish Event="AddLocal" Value="WebApp"><![CDATA[ServerType="Web"]]></Publish>
      <Publish Event="Remove" Value="WebApp"><![CDATA[ServerType<>"Web"]]></Publish>
      <Publish Event="AddLocal" Value="DataApp"><![CDATA[ServerType="App"]]></Publish>
      <Publish Event="Remove" Value="DataApp"><![CDATA[ServerType<>"App"]]></Publish>
      <Publish Event="AddLocal" Value="WebDevConfigFeature"><![CDATA[ServerType="Web" AND Environment="Dev" ]]></Publish>
      <Publish Event="Remove" Value="WebDevConfigFeature"><![CDATA[ServerType<>"Web" OR Environment<>"Dev"]]></Publish>
      <Publish Event="AddLocal" Value="WebQAConfigFeature"><![CDATA[ServerType="Web" AND Environment="QA" ]]></Publish>
      <Publish Event="Remove" Value="WebQAConfigFeature"><![CDATA[ServerType<>"Web" OR Environment<>"QA"]]></Publish>
      <Publish Event="AddLocal" Value="WebProdConfigFeature"><![CDATA[ServerType="Web" AND Environment="Prod" ]]></Publish>
      <Publish Event="Remove" Value="WebProdConfigFeature"><![CDATA[ServerType<>"Web" OR Environment<>"Prod"]]></Publish>
      <Publish Event="AddLocal" Value="AppDevConfigFeature"><![CDATA[ServerType="App" AND Environment="Dev" ]]></Publish>
      <Publish Event="Remove" Value="AppDevConfigFeature"><![CDATA[ServerType<>"App" OR Environment<>"Dev"]]></Publish>
      <Publish Event="AddLocal" Value="AppQAConfigFeature"><![CDATA[ServerType="App" AND Environment="QA" ]]></Publish>
      <Publish Event="Remove" Value="AppQAConfigFeature"><![CDATA[ServerType<>"App" OR Environment<>"QA"]]></Publish>
      <Publish Event="AddLocal" Value="AppProdConfigFeature"><![CDATA[ServerType="App" AND Environment="Prod" ]]></Publish>
      <Publish Event="Remove" Value="AppProdConfigFeature"><![CDATA[ServerType<>"App" OR Environment<>"Prod"]]></Publish>
      <Publish Event="EndDialog" Value="Return">1</Publish>

推荐答案

我喜欢做的技巧是让 2 个组件有 2 个不同的密钥文件

The trick I like to do is have 2 components with 2 different key files

c1 -> f1 ( web.config.dev )c2 -> f2 ( web.config.qa )c3 -> f3 ( web.config.prod )

c1 -> f1 ( web.config.dev ) c2 -> f2 ( web.config.qa ) c3 -> f3 ( web.config.prod )

然后为这些文件中的每一个提供一个 web.config 的副本文件元素和一个互斥条件

each of these files are then given a copy file element of web.config and a mutually exclusive condition

DEPLOYMENTTYPE~="DEV"部署类型~="QA"DEPLOYMENTTYPE~="PROD"

DEPLOYMENTTYPE~="DEV" DEPLOYMENTTYPE~="QA" DEPLOYMENTTYPE~="PROD"

结果是这些组件中不会再有 1 个被安装.你可能会得到一个 web.config.dev 和一个 web.config,它会起作用.

The result is no more then 1 of these components will get installed. You might get a web.config.dev and a web.config and it'll work.

所有这些都可以使用一个功能来完成.

All of this can be done using a single feature.

这篇关于WIX 安装程序中同一文件夹中的互斥文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆