Modify assemblies before MSI packaging

Hi,

I'd like to modify (obfuscate) my assemblies before they are packaged in the MSI by the Visual Studio Setup Project. However, it looks like it always builds before it packages the files. Is there a way to force it to take the already existing files from the primary output and use those for packaging without rebuilding them

Thanks,

Tom


Answer this question

Modify assemblies before MSI packaging

  • Mohit6032

    The post-build event would be invoked before the packaging. If it overwrote the primary output then the installer project would be using the obfuscated assemblies.

  • AdmSteck

    Would a project post-build event (release-only) not do what you want

  • Mervyn

    Another approach is more manual, but can be done, and probably even scripted with a batch file or so.

    Pre Step: Build your setup project so that it does NOT use built outputs, point it to include assemblies from disk. The best solution is to pick them up from a sub directory of the solution the Setup project is in.

    Step 1: Build your application. You can use MSBuild or DevEnv /Build

    Step 2: Copy the built binaries/files to a sub dir where the setup project is going to pick them up from.

    Step 3: Obfuscate your binaries

    Step 4: Build the Setup project. If the setup project is in another solution, it's easier ot use DevEnv /Build, or you can specify the Setup project name.

    Hope this helps.



  • Kevin Currier

    Hm, how would that help I need to build the application then obfuscate it manually and somehow get the installer project to use the obfuscated assemblies as primary output.

  • Modify assemblies before MSI packaging