Question

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.

Was it helpful?

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' />

OTHER TIPS

If you are using C#/DTF to write a custom action, you simply add the DLL's as references. For any other kind of file you add them to the project as Content | CopyAlways and the build will automatically include these files in the self extracting custom action. They will be available in the current directory ( a temp directory) when the CA runs and automatically cleaned up when the CA ends.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top