VS Installer Custom Action Question

If you have a web app merge module and an exe merge module included in the same setup-deployment project, the Context.Parameters[“AssemblyPath”] value inside the custom action for each merge module gets messed up. Try creating a setup-deployment project that has a web project and an app project like this:

  1. Create a Web project
  2. Create a merge module for that web project
  3. Create a regular App project
  4. Create a merge module for that app
  5. Create a setup project that has both the above merge modules
  6. Create a project for custom installer.
  7. In the Commit() method override, access Context.Parameters[“AssemblyPath”] and debug print out the value.
  8. Add this custom action project output to both your merge modules.
    Now do the install.
    You would expect different values to be printed depending on which merge module is calling this custom action. But they are the same ! Sometimes it is c:inetpubwwwroot and sometimes it is C:MyAppDir…

The merge module files do end up in the right place though:
The Web project content goes to C:Inetpubwwwroot
while the App project goes to ‘module retargetable folder’.
You will also notice the customactions.dll included in each merge module will end up in the right places (c:inetpubwwwroot in once case and ‘module retargetable folder’ in the other’).

But the debug print out of Context.Parameters[“AssemblyPath”] will show the same value in BOTH cases (ie both merge modules). It will both be C:InetpubwwwrootCustomActions.dll
or <targetdir>CustomActions.dll. This is wrong !

The debug print should show
C:InetpubwwwrootCustomActions.dll when the debug print is coming from the web project based merge module and
<targetdir>CustomActions.dll when the debug print is coming from the app project based merge module.

Does anybody know why the value is not updated per merge module ? Is this a bug in Microsoft VS ?

Leave a Comment