问题描述
我想要的是在解决方案中只有一个安装项目,并且我希望能够在一台计算机上同时安装"release1"和"release2"版本(如debug/release1/release2版本).因此,release1版本需要它自己的程序文件夹,产品代码和快捷方式等,而release2版本也需要它们自己的唯一版本.
What I want is to only have one setup project in my solution, and I want to be able to install 'release1' and the 'release2' versions (as in versions debug/release1/release2) simultaneously on one machine. So, the release1 version needs its own program folder, product code and shortcuts and such, and the release2 version needs its own unique versions of these things too.
但是,似乎安装项目没有为两个不同的发行版本存储单独的属性.似乎所有的不同之处在于输出路径,并且它们当然使用了不同的生成的exe.
It seems however the setup project doesn't store seperate properties for the two different release versions. Seems all thats different is the output path, and of course they use the different generated exes.
我是否必须转向Wix才能解决此问题?还是在这里我缺少一些简单的东西?您似乎无法将安装程序配置为针对两个不同的发行版执行不同的操作,这似乎有点愚蠢.到目前为止,看起来我将不得不创建另一个安装项目,这将很烦人,因为我不想维护一个安装项目,更不用说2了.
Am I going to have to move to Wix to solve this problem? Or is there something simple I'm missing here? It seems kind of stupid that you can't configure the installer to do different things for two different release versions. So far its looking like I'll have to make another setup project, which is going to be annoying because I don't like having to maintain one setup project let alone 2.
预先感谢您的帮助.
以撒
推荐答案
创建两个不同的安装项目,其中一个称为 Production Setup ,另一个称为 Test Setup 方式,因为它使OS相信您正在交付两种不同的产品,实际上在这里就是这种情况.
Creating two different setup projects, one called Production Setup and one called Test Setup might be the cleanest way, since it makes the OS believe you are delivering two different products, which is in fact the case here.
按照您自己的建议,移至WiX确实具有以下优点:您可以在两个安装项目中重复使用部件,例如,无需维护两次相同的文件列表.
Moving to WiX, as you suggested by yourself, has indeed the advantage that you can reuse parts in both your setup projects, avoiding the need to maintain the same list of files twice, for example.
当然还有另一种选择.如果您的 Production Setup 和您的 Test Setup 项目几乎相同,并且您只需要交换一些GUID(例如,产品或包装代码,以使MSI考虑它们)不同),创建一个简单的脚本,该脚本将第一个安装项目文件复制到第二个位置,并交换文件中的GUID(仅是XML文件).因此,您只需维护第一个项目文件,即可通过重新运行脚本轻松地重新生成第二个文件.
There is, of course, another option. If your Production Setup and your Test Setup projects are almost identical, and you need just to exchange some GUIDs (the product or package code, for example, to make MSI consider them to be different), create a simple script which copies the first setup project file to a second location and exchanges the GUIDs within the file (which is nothing but an XML file). So you have only to maintain the first project file and can regenerate the second one easily by rerunning the script.
我个人是在VBS中进行此类工作的,但是您也可以使用powershell或使用任何能够进行XML或RegEx处理的语言编写简单的工具.
Personally I am doing such stuff in VBS, but you can also use powershell for that or write a simple tool in any language capable of doing XML or RegEx processing.
这篇关于在vs 2010的安装项目中,对于两个不同的发行版,我如何拥有不同的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!