Search code examples
wixwindows-installerburn

WiX CustomAction: How to get bootstrapper location from msi


For a custom action I need the location of the installers bootstrapper path.

session["SourceDir"] gives me:

C:\ProgramData\Package Cache\{67668D1E-88B7-4D10-B1B5-98D42AA088E5}\...
but my setup during my test is located in C:\Temp which is what I would expect.


Solution

  • You need to pass bootstrapper variable into MSI.

    The variables you can pass: http://wixtoolset.org/documentation/manual/v3/bundle/bundle_built_in_variables.html

    This seems what you want: WixBundleOriginalSource - gets the source path from where the bundle originally ran.

    How can you pass it from the bootstrapper:

    <MsiPackage SourceFile='ProductSetup.msi' DisplayInternalUI='yes'>
       <MsiProperty Name='CONFIGFILELOCATION' Value='[WixBundleOriginalSource]' />
    </MsiPackage>
    

    This will make CONFIGFILELOCATION property available in your ProductSetup.msi file, which you then can access.