Wix:为单个文件类型创建多个关联 [英] Wix: Creating multiple associations for single file type
问题描述
我有一个基于Wix的安装程序,可以安装两个可执行文件.我想将自己的自定义文件类型与两个可执行文件相关联
I have a Wix based installer that installs two executables. I want to associate my own custom file type to both executables
<Component Id="A.exe" Guid="{GUID}">
<File Id="A.exe" Name="A.exe" Source="../A.exe" KeyPath="yes" Checksum="yes"/>
<ProgId Id="cfgfilerun" Description="Config file for A" Advertise="no" >
<Extension Id="cfg" ContentType="application/text" Advertise="no" >
<Verb Id="Run" Command="Run" TargetFile="A.exe" Argument='"%1"' />
</Extension>
</ProgId>
</Component>
然后再
<Component Id="B.exe" Guid="{GUID}">
<File Id="B.exe" Name="B.exe" Source="../B.exe" KeyPath="yes" Checksum="yes"/>
<ProgId Id="cfgfileopen" Description="Config file" Advertise="no" >
<Extension Id="cfg" ContentType="application/text" Advertise="no" >
<Verb Id="Open" Command="Open" TargetFile="B.exe" Argument='"%1"' />
</Extension>
</ProgId>
</Component>
不起作用.怎么修?行为是只有一个扩展出现并起作用,一个扩展为B.如果我注释掉B的ProgId,那么我得到一个扩展为A.
does not work. How to fix? Behavior is that only one of the extensions appears and works, the one for B. If I comment out B's ProgId, then I get the one for A.
推荐答案
通过将两个文件放在同一组件中进行修复:
Fixed it by putting both files in the same component:
<Component Id="A.exe" Guid="{GUID}">
<File Id="A.exe" Name="A.exe" Source="../A.exe" KeyPath="yes" Checksum="yes"/>
<File Id="B.exe" Name="B.exe" Source="../B.exe" Checksum="yes"/>
<ProgId Id="cfgfilerun" Description="Config file for A" Advertise="no" >
<Extension Id="cfg" ContentType="application/text" Advertise="no" >
<Verb Id="Run" Command="Run" TargetFile="A.exe" Argument='"%1"' />
<Verb Id="Open" Command="Open" TargetFile="B.exe" Argument='"%1"' />
</Extension>
</ProgId>
</Component>
我查看了来自msiexec
的日志记录的调试输出,在执行cfg文件之前,它所做的只是看起来很破损.我认为这是Wix中的错误,您需要将所有内容都包含在同一组件中.总的来说,我对Wix整体感到有些失望,但是我再也没有使用过任何比赛.也许所有的Windows安装程序都是一团糟.
I looked at the debug output from logging from msiexec
, what it was doing before with the cfg file just looked broken. I think this is a bug in Wix that you need to have everything in the same component. Generally, I'm a little disappointed with Wix overall, but then again I haven't used any of the competition. Perhaps all Windows installers are a total morass.
这篇关于Wix:为单个文件类型创建多个关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!