birdy90
birdy90

Reputation: 143

Creating file association with WiX Toolset

I created an application that can open image files. Now I'm creating an installer using the WiX Toolset. For the last couple of days, I am stuck with some misunderstanding: trying to register my app and associate it with desired extensions. Everything appears in the registry but none of my files open with my application, as if it was not installed.

This is the part where I describe the executable file and register all of the extensions for it:

<Component Id="CmpLightImageViewer.exe" Guid="{...}">
  <File Id="MainExe" Name="LightImageViewer.exe" />
</Component>

<Component Id="CmpLightImageViewerProgId" Guid="{391FBC30-B5A1-4AB7-8FA4-254C1CE2BF69}" KeyPath="yes">
  <ProgId Id="LightImageViewerSvg" Description="Light image viewer">
    <Extension Id="svg">
      <Verb Id="open" TargetFile="MainExe" Argument="&quot;%1&quot;" />
    </Extension>
  </ProgId>
  <ProgId Id="LightImageViewerGif" Description="Light image viewer">
    <Extension Id="gif">
      <Verb Id="open" TargetFile="MainExe" Argument="&quot;%1&quot;" />
    </Extension>
  </ProgId>
...
</Component>

That is what I see in my registry HKCR. The same in HKCU/Software/Classes, but not in HCLM/Software/Classes:

enter image description here

What am I missing? What else do I need to do to make it work? While I can set file associations manually for each type using Windows tools, that's not how I want it to work.

I'm building it with vs2015 in windows10 using wix3.10

Upvotes: 6

Views: 5126

Answers (2)

slayer69
slayer69

Reputation: 81

I can see potential issue in data which are written in registry. The path seems wrong due to redundant quotation marks. You path should looks like:

"C:\Program Files (x86)\LightImageViewer\LightImageViewer.exe %1"

Upvotes: 0

Nikolay
Nikolay

Reputation: 12245

This is the sort of security feature started in Vista - Windows protects "default" associations, allowing the user to select them. If you want your program to be the "default" for handling existing file types, thus overriding user settings (this is exactly what this feature was supposed to prevent, as far as I understand), then you may take a look at this question for an example:

How to associate application with existing file types using WiX installer?

Upvotes: 3

Related Questions