Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WIX: How to register an Application to a URL Protocol?

In WiX you can register file types easily:

<ProgId Id="MyApp.File" Description="MyApp File" Icon="MyAppEXE" IconIndex="0">
  <Extension Id="ext" ContentType="application/x-myapp-file">
    <Verb Id="open" Command="&amp;Open" TargetFile="MyAppEXE" Argument="&quot;%1&quot;"/>
  </Extension>
</ProgId>

What if I want to register an URL protocol, as specified here? Obviously, it has no extension so where would I put the Verb tag? Or should I use another approach?

Thanks.

like image 994
l33t Avatar asked Nov 29 '11 01:11

l33t


2 Answers

Just to add the code of the @Yan Sklyarenko's answer:

<Component Id="ProductComponent" Guid="{206C911C-56EF-44B8-9257-5FD214427965}">
           <File Source="$(var.MyMainProgram.TargetPath)" />
           <RegistryKey Root="HKCR"
                 Key="protocolname"
                 Action="createAndRemoveOnUninstall">
             <RegistryValue Type="string" Name="URL Protocol" Value=""/>
             <RegistryValue Type="string" Value="URL:name of the protocol"/>
             <RegistryKey Key="DefaultIcon">
               <RegistryValue Type="string" Value="MyMainProgram.exe" />
             </RegistryKey>
             <RegistryKey Key="shell\open\command">
               <RegistryValue Type="string" Value="&quot;[INSTALLFOLDER]MyMainProgram.exe&quot; &quot;%1&quot;" />
             </RegistryKey>
           </RegistryKey>
         </Component>
  • MyMainProgram is a reference to my main project in the wix setup project
  • protocolname is the name of the protocol used in the url: protocolname://
  • name of the protocol is the formal name of the protocol
like image 89
Jérémie Bertrand Avatar answered Sep 28 '22 05:09

Jérémie Bertrand


I doubt there's an out-of-the-box feature for this in WiX (probably, in 3.6?), but as far as I can see by the link you provided, the process of registering a URL protocol is adding a bunch of entries to the system registry. Hence, you can add RegistryKey/RegistryValue elements manually to emulate this.

like image 37
Yan Sklyarenko Avatar answered Sep 28 '22 06:09

Yan Sklyarenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!