I am using WiX 3.0.2925 to create an installer, and I am having a very hard time getting file associations to work correctly. My case may be a little strange, and I am not sure if Windows Installer even supports it. Basically, I have an application that can be launched in two different contexts: desktop and clustered. The desktop launching is done using a batch file while the clustered launching is done using an external application. If that external application is installed, then I need to add an extra verb for my file extension in the registry. I use RegistrySearch to determine if the external application is installed, though I do not yet have that working very well yet.
I have tried to do this a number of ways, and they all cause the installer
to crash in one way or another. Currently, I am just trying to set up the
simple case where the batch file is used. If the following component is
included in a feature, it works (though I have not gotten the icon stuff
sorted out yet):
<Fragment>
<DirectoryRef Id="app">
<Component Id="desktop.bat_1" Guid="{...}">
<Condition>
CLUSTERGUI = "" OR PYTHONDIR = ""
</Condition>
<File Id="desktop.bat" Name="desktop.bat" KeyPath="yes"
Source="dist\app\desktop.bat" />
<ProgId Id="myapp.myext" Description="MyApp Document"
Advertise="yes">
<Extension Id="myext"
ContentType="application/myapp-myext+xml">
<Verb Id="openBatchFile"
Command="Open in MyApp (Desktop)"
Argument=""%1"" />
</Extension>
</ProgId>
</Component>
</DirectoryRef>
</Fragment>
This fragment, however, causes a crash:
<Fragment>
<DirectoryRef Id="app">
<Component Id="desktop.bat_1" Guid="{...}">
<Condition>
CLUSTERGUI = "" OR PYTHONDIR = ""
</Condition>
<File Id="desktop.bat" Name="desktop.bat" KeyPath="yes"
Source="dist\app\desktop.bat" />
<ProgId Id="myapp.myext" Description="MyApp Document">
<Extension Id="myext"
ContentType="application/myapp-myext+xml">
<Verb Id="openBatchFile"
TargetProperty="[!desktop.bat]"
Command="Open in MyApp (Desktop)"
Argument=""%1"" />
</Extension>
</ProgId>
</Component>
</DirectoryRef>
</Fragment>
The reason that I want to use the TargetProperty of the Verb element is so
that I can do the following as the other condition:
<Fragment>
<DirectoryRef Id="app">
<Component Id="desktop.bat_2" Guid="{...}">
<Condition>
CLUSTERGUI <> "" AND PYTHONDIR <> ""
</Condition>
<File Id="desktop.bat" Name="desktop.bat" KeyPath="yes"
Source="dist\app\desktop.bat" />
<ProgId Id="myapp.myext" Description="MyApp Document">
<Extension Id="myext"
ContentType="application/myapp-myext+xml">
<Verb Id="openCluster"
TargetProperty="[PYTHONDIR]\pythonw.exe"
Command="Open in MyApp (Cluster)"
Argument="..." />
<Verb Id="openBatchFile"
TargetProperty="[!desktop.bat]"
Command="Open in MyApp (Desktop)"
Argument=""%1"" />
</Extension>
</ProgId>
</Component>
</DirectoryRef>
</Fragment>
I have tried other variations where I use separate components to contain the
two Verb elements or where I separate the ProgId from the component
containing the File element. Nothing works, and all I can conclude at this
point is that I am doing something wrong or I am trying to do something that
WiX does not allow.
Am I simply on the wrong path with trying to have conditional verb addition
for a file association? If so, is there some other approach that I could try?
-Patrick
--
Patrick L. Hartling
VP Engineering, Infiscape Corp.
http://www.infiscape.com/
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ WiX-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wix-users

