Building Managed Custom Actions

Deployment Tools Foundation .NET

Deployment Tools Foundation Building Managed Custom Actions

The build process for managed CA DLLs is a little complicated becuase of the proxy-wrapper and dll-export requirements. Here's an overview:

  1. Compile your CA assembly, which references Microsoft.Deployment.WindowsInstaller.dll and marks exported custom actions with a CustomActionAttribute.

  2. Package the CA assembly, CustomAction.config, Microsoft.Deployment.WindowsInstaller.dll, and any other dependencies using MakeSfxCA.exe. The filenames of CustomAction.config and Microsoft.Deployment.WindowsInstaller.dll must not be changed, since the custom action proxy specifically looks for those files.


Compiling


    csc.exe
        /target:library
        /r:$(DTFbin)\Microsoft.Deployment.WindowsInstaller.dll
        /out:SampleCAs.dll
        *.cs
            

Wrapping


    MakeSfxCA.exe
        $(OutDir)\SampleCAsPackage.dll
        $(DTFbin)\SfxCA.dll
        SampleCAs.dll
        CustomAction.config
        $(DTFbin)\Microsoft.Deployment.WindowsInstaller.dll
            

Now the resulting package, SampleCAsPackage.dll, is ready to be inserted into the Binary table of the MSI.


For a working example of building a managed custom action package you can look at included sample ManagedCAs project.



See also: