Run Dotfuscator CE in Visual Studio 2012 in Building

Unfortunately my approach is not perfect in that it still opens the GUI of Dotfuscator that requires a manual clicking. It is good for me though since I only run it during building in Release mode.

Here is how I run the command during building:

Find the location of Dotfuscator CE which is included in VS2012 by going to Tools -> External Tools.

Copy the path from the Command box.

3-29-2013 2-25-27 PM

Open the property of your project and go to Build Events.

3-29-2013 2-27-17 PM

Click on Edit Post-build and enter the following

if “$(ConfigurationName)” == “Release” (“%The path copied from the Command box%” /in:”$(TargetPath)” /out:”$(TargetDir)\Dotfuscator”
copy /Y “$(TargetDir)\Dotfuscator\$(TargetFileName)” “$(TargetPath)” )

What these lines do is

1. When the project is being built in Release mode, run the Dotfuscator.

2. Output the altered DLL into a folder named Dotfuscator under your target path (Normally the bin/release folder).

3. Copy this altered DLL to the folder where regular DLL resides and overwrite it.

One thought on “Run Dotfuscator CE in Visual Studio 2012 in Building

  1. dharmeshsharma says:

    if”$(ConfigurationName)”==”Release”(“%C:\Program Files (x86)\Microsoft Visual Studio 12.0\PreEmptive Solutions\Dotfuscator and Analytics Community Edition\Dotfuscator.exe%” /in:”$(TargetPath)” /out:”$(TargetDir)\Dotfuscator” copy /Y “$(targetDir)\Dotfuscator\$(TargetFileName)” “$(TargetPath)”

    throw me error

Leave a comment