WIX 分别创建32位64位安装程序
2015-06-08 14:39
239 查看
Rather than conditionally including the opening
(which invalidates the XML), conditionally set preprocessor variables which are used as directory names, as @Daniel Pratt's comment refers to. Similarly, having a "yes/no" variable conditioned on platform makes it easy to set up 64 bit components, registry
searches, etc.
(From this answer)
built-in, but its value is used to define custom variables
You can either use preprocessor
to test variables' values (as is done with
defining the custom variables above) or have the preprocessor insert variables' values into XML attribute or element values. Couple of examples:
This will produce warnings in the Visual Studio WiX editor about
being one of the allowable attribute values (
but these can be safely ignored, because the preprocessor will have substituted an appropriate value by the time the compiler gets hold of it.
In response to rharrison33's comment asking how to handle the requirement for different product codes (or pretty much anything) in the 32 and 64 bit installers (assuming you can't/don't want to auto-generate them):
Pass separate product codes to candle as preprocessor variables, on the command line or using a response file:
Add a product code as one of your architecture-dependent preprocessor variables, and set it to the appropriate input variable:
In the 32-bit
In the 64-bit
Refer to
Made this CW because Daniel's link answers the question and has a lot more great info besides.
Directoryelements
(which invalidates the XML), conditionally set preprocessor variables which are used as directory names, as @Daniel Pratt's comment refers to. Similarly, having a "yes/no" variable conditioned on platform makes it easy to set up 64 bit components, registry
searches, etc.
Defining the variables
(From this answer)<?if $(var.Platform) = x64 ?> <?define ProductName = "Product Name (64 bit)" ?> <?define Win64 = "yes" ?> <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?> <?else ?> <?define ProductName = "Product Name" ?> <?define Win64 = "no" ?> <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?> <?endif ?>
$(var.Platform)is
built-in, but its value is used to define custom variables
$(var.ProductName),
$(var.Win64)and
$(var.PlatformProgramFilesFolder).
Using the variables
You can either use preprocessor <?ifdirectives
to test variables' values (as is done with
$(var.Platform)when
defining the custom variables above) or have the preprocessor insert variables' values into XML attribute or element values. Couple of examples:
32/64-bit components
<Component Id="..." Win64="$(var.Win64)"> ... </Component>
This will produce warnings in the Visual Studio WiX editor about
$(var.Win64)not
being one of the allowable attribute values (
yes/
no)
but these can be safely ignored, because the preprocessor will have substituted an appropriate value by the time the compiler gets hold of it.
32/64 bit Program Files directory
<Directory Id="$(var.PlatformProgramFilesFolder)"> ... </Directory>
Update to handle separate 32/64 bit product codes
In response to rharrison33's comment asking how to handle the requirement for different product codes (or pretty much anything) in the 32 and 64 bit installers (assuming you can't/don't want to auto-generate them):Pass separate product codes to candle as preprocessor variables, on the command line or using a response file:
candle <all other flags> -d ProductCode32=<guid1> -d ProductCode64=<guid2>
Add a product code as one of your architecture-dependent preprocessor variables, and set it to the appropriate input variable:
In the 32-bit
<?if ?>branch:
<?define ProductCode = "$(var.ProductCode32)" ?>
In the 64-bit
<?if ?>branch:
<?define ProductCode = "$(var.ProductCode64)" ?>
Refer to
$(var.ProductCode)in
Product/@Id.
Made this CW because Daniel's link answers the question and has a lot more great info besides.
相关文章推荐
- js DOM节点
- 韦东山视频心得体会之矢量字体
- 黑马程序员 - 技术 blog12 之 类库 by 八戒
- 如何使用junit4写单元测试用例(转)
- DTcmsV4.0分析学习——(1)数据库结构分析
- 总结一下最近几个月的开发过程
- Android中Fragment的分屏显示处理横竖屏显示
- 正则表达式学习笔记(一)
- tp跳转
- iOS 过滤emoji表情
- Flume Source 实例
- 使用js做出弹窗效果
- wpf之ContentControl
- L上自定义一个属性,如何开启这个属性的写的权限
- SELinux(Security-Enhanced Linux)
- Swift学习笔记六
- Sharepoint2013:在页面上显示错误信息
- Handling Technical Questions
- android uri to file
- 对象序列化和反序列化