How to use PreEmptive Dotfuscator in Visual Studio Setup project to protect your code 25

NOTE: After chatting with PreEmptive support, I was told that the Command Line Interface of Dotfuscator CE does not support Visual Studio 2013 or lower. It only supports, at the time of this note, Visual Studio 2015 and 2017.

In this post, I will show you how to use PreEmptive Dotfuscator Community Edition in Visual Studio 2010 setup project to protect your source code.

By default, PreEmptive Dotfuscator CE is integrated in Visual Studio 2010, however, it does not support the command line execution and you will need the command line ability to make it work in VS setup project. The command line file is called dotfuscatorCLI.exe and can be downloaded from PreEmptive’s web site after you register: After registration, download the CE installer and executed, it should automatically add the command line exe file to your computer. Refer to this post:

Now let’s see how to use it in the setup project.

I assume you know how to add Project Output of your target application to the setup project, so I will skip this step. Now, right-click your target application in the Solution Explorer and choose Properties, then click on Build Events option on the left side:


Click on Edit Post-build button and type in the following commands:


“C:\Program Files (x86)\Microsoft Visual Studio 10.0\PreEmptive Solutions\Dotfuscator Community Edition\dotfuscatorCLI.exe” /in:$(TargetFileName)
copy /y “$(TargetDir)Dotfuscated\$(TargetFileName)” “$(TargetDir)$(TargetFileName)”

The first command is to run Dotfuscator in the command line on the target application to generate a dotfuscated version of the project output. Since by default, Dotfuscator will store the dotfuscated output under a subfolder called “Dotfuscated”, the second command is basically copy the dotfuscated project output and overwrite the un-dotfuscated project output, therefore, when you build your setup project, the dotfuscated project output will be packaged in the final installer package.

Hope this will help someone.

Leave a Reply

25 Comments on "How to use PreEmptive Dotfuscator in Visual Studio Setup project to protect your code"

Notify of
Sort by:   newest | oldest

Thanks for the info but I tried and no dotfuscatorCLI.exe file dropped in the directory.


Thanks Jeffrey. I did register and downloaded the patch (link to When I tried to install it, it promopts selections for repair or removal of dotufuscator and I selected repair. and it preceeds without problem. but after it finished, I cannot find the dotfuscatorCLI.EXE anywhere. By the way, the instruction says after registration, “go to the Downloads section”, but I don’t find the section (except for the patch) in the website.


Thanks again for your help, Jeffery. Yes, I have Visual Studio 2010 Professional installed. and I checked the directory exactly as in your screen shot in your post and then searched the whole computer and cannot find the exe file. While I cannot find DotfuscatorCLI.exe, the gui version (dotfuscator.exe) did say the version is 5.0.2600.0, so it seemed the patch did do something.



I think Version 5.0.2600 will not be sufficient. Try to get “5.0.2601” instead.
After registration it should be available under “my account\downloads” or something similiar..


I tried and it works! Thank you very much for the help!

Hi guys, perhaps a little bit late, but I followed your instructions here and I completed all the registrations and downloads from PreEmptive and I face on a specific problem. When I double click to install the DotfuscatorCE5Patch5.0.2601.msp file the windows installer provide me with the following error: The upgrade patch cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade patch may update a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. I… Read more »

I had the same problem.
My solution is:
– open the msp-File (Patch) with 7-Zip (or another unpacker)
– extract the files to the original program destination
– backup original files
– rename the extracted files to the original files. (delete original files first, only add dots for renaming)
Hope that helps.


super helpful! thanks!!


Wicked!  Was looking all over for something just like this. Thanks a million.  (heck I would have even paid 10 bucks!)


Hello, thank you for the useful article. Even though i have downloaded the command line exe, added the two lines in the post-build event,and builded the application succesfully, the .exe that i get when i install the executable is still not obfuscated. However, the exe file in the bin/ debug file is obfuscated! What am i doing wrong? Thank you very much for your time


I wanted know if after paying for the visual studio-2010, should we pay something in order to avail the dotfuscator facility ( I mean for that downloading You mentioned or any other associated purchase)?


Hey I also wanted to know if the dotfuscator facility can be availed in the trial version of visual studio-2010 as well? Is dotfuscator found only in the "professional-10" or is it available in other versions like ultimate-10 and others?

Patel Rikin

First I would like to thanks for post build command
but this command not working because setup project take assemblies from intermediate output of main project
i found solution after many hours which below code…

if $(ConfigurationName)==Release (
cd "$(ProjectDir)$(IntermediateOutputPath)"
For /f "tokens=*" %%a in ('dir /b *.exe *.dll') do "C:\Program Files\Microsoft Visual Studio 10.0\PreEmptive Solutions\Dotfuscator Community Edition\dotfuscatorCLI.exe" /in:%%a
del Dotfuscated\map*.xml
copy /y Dotfuscated\*.*
rmdir /s /q Dotfuscated
) else (
echo "do something"

its work fine and well tested and i added functionality for all assemblies not only one main exe.
if you have suggestion then tell me for improve and if u have any error then tell me.


Thanks a lot, it worked like a charm for me  :)



It is very important info. Thanks for sharing it. Just wanted to know whether we have Dotfuscator Command Line support for VS 2012?


Thanks a lot all worked like a charm (after the initial trouble of having to register etc, which is worth considering the end result).


Please, answer about command line support for VS 2012. Is there similar dotfuscatorCLI.exe utility for it?


I have just updated my Obfuscator CE package from the above mentioned site, but i am unable to find the ObfuscatorCLI.exe. can anyone help me please :(