Search code examples
wixnamespaceswix3registration

Installing Namespace Extension with Microsoft WIX


What is the best/easiest way to install a namespace extension using wix? Especially how do I install it on Windows 7 with enabled UAC.


Solution

  • I've solved this with by using a built in custom action from WiX where you just set the command line option before running the custom action. Here's an example how we do it:

    <CustomAction Id='RegisterExtensions.SetProperty' Property='QtExecCmdLine' 
        Value='"[INSTALLDIR]RegisterExtensionDotNet20_x86.exe" -i "[INSTALLDIR]LogicNP.EZShellExtensions.dll" "[INSTALLDIR]LogicNP.EZNamespaceExtensions.dll" "[INSTALLDIR]MyNse.dll"'/>
    
    <CustomAction Id='RegisterExtensions' BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>
    

    This has to be done also for 64 bit. I have separate 64 bit version of the custom action also:

    <CustomAction Id='RegisterExtensions64.SetProperty' Property='QtExecCmdLine'
          Value='"[INSTALLDIR]RegisterExtensionDotNet20_x64.exe" -i "[INSTALLDIR]LogicNP.EZShellExtensions.dll" "[INSTALLDIR]LogicNP.EZNamespaceExtensions.dll" "[INSTALLDIR]MyNse.dll"'/>
    
    <CustomAction Id='RegisterExtensions64' BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="check"/>
    

    You have to schedule the registration process also into the WiX build file:

    <Custom Action="RegisterExtensions.SetProperty" Before="RegisterExtensions">(NOT Installed)</Custom>
    <Custom Action='RegisterExtensions' After="InstallFinalize">(NOT Installed)</Custom>
    <Custom Action='RegisterExtensions64.SetProperty' Before='RegisterExtensions64'>(NOT Installed) AND (VersionNT64)</Custom>
      <Custom Action='RegisterExtensions64' After='RegisterExtensions'>(NOT Installed) AND (VersionNT64)</Custom>
    

    A consequence is that you need to include the EZNamespaceExtension executables in your installer.