Wednesday, October 6, 2010

Obfuscating an Autodesk Revit Plugin

Jeremy Tammik mentions obfuscation for Revit plugins in his post Obfuscation Tools. I would like to mention two free obfusctators I have used:

Both of these can be hooked up to your build script so that they obfuscate automatically. Please read their documentation on how to do this.

I liked Eazfuscator a lot and used it for all dependant assemblies of my project, but sadly, it chokes on references to the assembly RevitAPI. So for developing Autodesk Revit Plugins, it will not work.

Babel .NET can obfuscate assemblies that reference RevitAPI.dll. I tied it into my build process in Visual Studio 2010 as a Post-build event command line:

  1. select your project in the Solution Explorer

  2. right-click and choose Properties from the context menu

  3. in the tab Build Events, enter the following in the field Post-build event command line:

    if /I "$(ConfigurationName)" NEQ "Debug" "C:\Program Files\Babel\Babel.exe" "$(TargetPath)" --stringencrypt --output "$(TargetPath)"
    

This assumes, of course, that you have installed Babel .NET to C:\Program Files\Babel. Also note, that the build configuration "Debug" is excluded from obfuscation.