Search code examples
wixwix3.5wix3wix3.6wix3.7

WiX: how to pack exe or dll to use only during installation


I need to include a dll/exe in the resulting MSI (created through a WiX project), but I do not want to deploy them during installation: I only want to use them in some CustomAction my purpose is to include an existing exe/dll and call it during installation from wxs code (not from a CustomAction dll).
Is it possible to include files which are not deployed during installation? I mean, only pack them inside the resulting MSI, and call them for some task while they are unpacked inside %temp% folder?
Also, it would be nice if somebody could show some sample code of how to include dll/exe through the Product.wxs XML code unit.
Thanks.


Solution

  • Yes, include them using the Binary element.

    <Binary Id='MyCustomActionBinary'
            SourceFile='$(var.CustomActionProject.TargetPath)' />
    

    This will make them available to your CustomAction where you can use the BinaryKey attribute to reference the Binary:

    <CustomAction Id='MyCustomAction'
                  BinaryKey='MyCustomActionBinary'
                  DllEntry='MyCustomFunction'
                  Execute='deferred' />