How to Invoke InstallUtil.exe in WiX Custom Action to Call Your Managed Installer Class

Following sample wxs file demonstrates how to use CustomAction to invoke InstallUtil.exe to run your managed installer class.

<?xml version='1.0'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
   <Product Id='12345678-1234-1234-1234-123456789012' Name='Test Package' Language='1033'
            Version='1.0.0.0' Manufacturer='Microsoft Corporation'>
      <Package Id='12345678-1234-1234-1234-123456789012'
                Description='My first Windows Installer package based on InstallUtil.exe'
                Comments='This is my first attempt at creating a Windows Installer database'
                Manufacturer='Microsoft Corporation' InstallerVersion='200' Compressed='yes' />
 
      <Media Id='1' Cabinet='product.cab' EmbedCab='yes' />
 
      <Directory Id='SourceDir' Name='SourceDir'>
         <Directory Id='ProgramFilesFolder' Name='PFDir'>
            <Directory Id='TestDir' Name='TestDir' LongName='Test Program'>
               <Component Id='MyComponent' Guid='12345678-1234-1234-1234-123456789012'>
                   <File Id='tryInstall' Name="try" LongName='tryInstall.exe' DiskId='1' src='tryInstall.exe' />
               </Component>
            </Directory>
         </Directory>
      </Directory>
 
      <Feature Id='MyFeature' Title='My 1st Feature' Level='1'>
         <ComponentRef Id='MyComponent' />
      </Feature>      

      <InstallExecuteSequence>
         <Custom Action='ManagedInstall' After="InstallFinalize" />
      </InstallExecuteSequence>
 
      <CustomAction Id="ManagedInstall"
            Directory='TestDir'
            ExeCommand='"[WindowsFolder]\Microsoft.NET\Framework\v2.0.50727\installUtil.exe" /LogToConsole=false tryInstall.exe'
            Return='check'>
      </CustomAction>
   </Product>
</Wix>

See also

  • Introduction to the Windows Installer XML(WiX) Toolset
  • MSI basics
  • WiX Tutorial - Steps to Create an MSI with Windows Installer XML(WiX)
  • How to Install a COM DLL with Windows Installer XML(WiX)
  • How to Add a License Agreement UI to Windows Installer XML(WiX)
  • How to Add Customization Code CustomAction to Windows Installer XML(WiX)
  • How to Reset Windows Service with Windows Installer XML(WiX)
  • How to Troubleshoot MSI Installation
  • How to Pass Parameters to the Customization Code(CustomAction)
  • How to Log Tracing Infomation to the Calling MSI from CustomAction
  • How to Invoke InstallUtil.exe to Call Your Managed Installer Class
  • How to Create a Website and Virtual Directory with Windows Installer XML(WiX)
  • How to Install Files to an Arbitrary Location Outside "Program Files"
  • How to Read Configuration Parameters from Xml File
  • How to Use Environmental Variables and WiX Preprocessor
  • Download WiXSharp



  • THIS POST IS PROVIDED "AS-IS" WITH NO WARRANTIES AND CONFERS NO RIGHTS. Build time: Sun 01/27/2008 . ©2007 Dalun Software. All rights reserved. Back to Article List