My Software Notes

Useful things I discover

Using Dotfuscator Community Edition

leave a comment »

Just in case you didn’t know, Dotfuscator is an obfuscator that comes with Visual Studio. The version in VS is the “Community Edition,” an emasculated version of the “Standard” and “Professional” products.

My first thought was that PreEmptive Solutions the makers of Dotfuscator would have made the community edition really easy to use and would have provided fast step-by-step instructions to tell you how to integrate it into your build. But no, it was not to be. Although the GUI is easy to use, the command line version (in the Community Edition) is not really a command line version.

The first thing you need to know is that the command line doesn’t really work in the CE version. All it does is open the GUI with the parameters you’ve passed in (better than nothing I guess) and then you have to click the “build” button. Also it doesn’t run unless the VS UI is open. Do you get the idea they REALLY want you to buy either Standard or Professional? I don’t blame them for that, but it would help if they gave you documentation specifically for the CE edition, and not just for Pro, leaving it to you to figure out how much of it doesn’t apply.

Anyway, basic steps:
1. You create a Dotfuscator “project” for your application. Just follow the standard instructions for creating a project in the GUI. The project file is really just an XML file that contains the data needed by the program to obfuscate your assemblies.
2. Now create a Visual Studio “Post-Build” event in the “Properties” page of your assembly that calls dotfuscator and creates your obfuscated assembly. (Command Line Options) Here is an example command line (I split it across four lines so it wouldn’t make this post wider than your monitor):

"C:\Program Files\Microsoft Visual Studio 9.0\
Application\PreEmptive Solutions\
Dotfuscator Community Edition\dotfuscator" -v
"$(ProjectDir)$(OutDir)TestObfuscDF.xml"

Don’t forget the quotes around the paths and that includes $(ProjectDir), etc. which are macros supplied by the Post-Build Dialog.

3. When you run your build from the VS UI, the Dotfuscator UI will open when your post-build event is hit and you’ll have to click on the “Build” button. The VS build execution pauses until you close the Dotfuscator UI, then it will finish.

So there you have it.

Here is a list of other .NET obfuscators: .NET Obfuscation.

I also came across an open-source .NET obfuscator but you can only get at the source-code if you buy the eBook: Desaware: Obfuscating .NET: Protecting your code from prying eyes.

Advertisements

Written by gsdwriter

March 3, 2009 at 3:26 pm

Posted in Tools

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: