I don't know if the title is really correct (any correction is welcome).
I created a wpf application and used Wix to generate an installer. This application can create a project and save it in any directory.
What I wanted to do, is to be able to start my application and open the project, by just doing a double click on it (like clicking on an .sln file for Visual studio)
to do that, I added this code in my product.wxs:
<Directory Id="GlobalFolder" Name="$(var.CompanyName)" >
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName)">
<Directory Id="ProtocolsFOLDER" Name="ProtocolFiles"/>
<Directory Id="ImagesFOLDER" Name="Images"/>
<Component Id="MainExecutable" Guid="3948E0F1-BF20-4620-81D8-EE5867C4F96F">
<File Id="exe" Name="ARROW.exe" DiskId="1"
Source="$(var.Arrow.TargetDir)\Arrow.exe" KeyPath="yes">
</File>
<!-- Capabilities keys for Vista/7 "Set Program Access and Defaults" -->
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities" Name="ApplicationDescription" Value="Arrow Application" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities" Name="ApplicationIcon" Value="[APPLICATIONFOLDER]ARROW.exe,0" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities" Name="ApplicationName" Value="ARROW" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities\DefaultIcon" Value="[APPLICATIONFOLDER]ARROW.exe,1" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities\FileAssociations" Name=".arr" Value="Arrow.Document" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities\MIMEAssociations" Name="application/Arrow" Value="Arrow.Document" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\Capabilities\shell\Open\command" Value=""[APPLICATIONFOLDER]Arrow.exe" -c "%1"" Type="string" />
<RegistryValue Root="HKLM" Key="Software\$(var.ProductName)\RegisteredApplications" Name="Arrow" Value="Software\$(var.ProductName)\Capabilities" Type="string" />
<!-- App Paths to support Start,Run -> "ARROW" -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Arrow.exe" Value="Arrow.exe" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Arrow.exe" Name="Path" Value="[APPLICATIONFOLDER]" Type="string" />
<!-- Extend to the "open with" list + Win7 jump menu pinning -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\Arrow.exe\SupportedTypes" Name=".arr" Value="" Type="string" />
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\Arrow.exe\shell\open" Name="Arrow Software" Value="Arrow" Type="string" />
<!-- MyApp.Document ProgID -->
<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Arrow.Document" Name="arr" Value="Arrow Project File" Type="string" />
<ProgId Id="Arrow.Document" Description="Arrow Project File" >
<Extension Id="arr">
<Verb Id="open" Command="Open Arrow" Target="exe" TargetFile="exe" Argument=" "%1"" />
<MIME ContentType="application/ARROW" Default="yes" />
</Extension>
</ProgId>
</Component>
</Directory>
</Directory>
It works well, when I double-click on the project it opens my application, but the problem is that the application needs some files from this directory (in the install folder)
<Directory Id="ProtocolsFOLDER" Name="ProtocolFiles"/>
But when I attached the process with Visual, I found that the application is searching the needed files in the project location (project on which I double-clicked).
It looks like a problem of indexation somewhere in the registryValues! can anyone help me? Thanks
Finally, all this behaviour was normal. What I had to do is to change my relative paths inside my application source code from something like:
To:
It works. Always refer ro the assembly.