views:

302

answers:

1

I have a multi-project Visual Studio 2008 solution. I would like to obfuscate some of the project outputs before they are built into the Setup file using Dotfuscator. So I would like to be able to:

  1. Be able to select what to obfuscate
  2. Create a Setup package that contains the already obfuscated code
  3. Verify if the obfuscation was a success

What is the best way to do this?
(I am also willing to use other tools, Dotfuscator is not a must.)

+1  A: 

If you are using either of the commercial versions of Dotfuscator (Dotfuscator Suite or Dotfuscator MDE) this is very easy to accomplish. Dotfuscator provides a Visual Studio project that can use other projects outputs as its input. The Dotfuscator project also exposes all of its output assemblies to other Visual Studio projects (including the various Setup project types) so that they can directly consume the obfuscated assemblies and build them into the installer. See this knowledge base article for some additional information on selectively including obfuscated assemblies and dependancies into setup projects.

You can select which assemblies to obfuscate (and how much obfuscation is applied to each of them) in a number of ways including decorating your assemblies or specific code with the System.Reflection.ObfuscateAssemblyAttribute or System.Reflection.ObfuscationAttribute and/or using the various settings in the Dotfuscator user interface to include or exclude assemblies and items from the various obfuscation transformations with a series of rules (including regular expressions) and/or selecting individual items in the GUI.

By default Dotfuscator adds an attribute (DotfuscatorAttribute) to each assembly it processes that you can then check with a script after the build or test install to make sure that the attribute is present. See http://www.preemptive.com/products/dotfuscator/manuals/NoDotfuscatorAttribute_Global_Option.html for some information on this attribute.

Joe Kuemerle
Selected the answer as best, but still not enough.
Germstorm