Learning While Aging

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

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: http://www.preemptive.com/support/dotfuscator-support. After registration, download the CE installer and executed, it should automatically add the command line exe file to your computer. Refer to this post: https://www.preemptive.com/dotfuscator-ce-command-line

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:

DotfuscatorInPostBuildEvent

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

PostBuildEventsWithDotfuscator

“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.

0 0 vote
Article Rating
Subscribe
Notify of
guest
25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
axin
axin
9 years ago

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

axin
axin
9 years ago

Thanks Jeffrey. I did register and downloaded the patch (http://files.preemptive.com/CE5/DotfuscatorCE5Patch5.0.2600.msp). 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.

Elsa
3 years ago
Reply to  _NTOTL_

Hi, i cant get DotfuscatorCLI.exe for vs 2013 after updating my package? kindly help me in resolving this issue

axin
axin
9 years ago

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.

Sebastian
Sebastian
9 years ago

Hi,

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..

axin
axin
9 years ago

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

Paul
Paul
9 years ago

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 »

Peter
Peter
9 years ago
Reply to  Paul

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.

Noah
Noah
8 years ago

super helpful! thanks!!

DaveCS
8 years ago

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

filistor
filistor
7 years ago

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

testingcoding
testingcoding
7 years ago

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)?

testingcoding
testingcoding
7 years ago

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
Patel Rikin
7 years ago

      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… Read more »

Abednego
Abednego
6 years ago

Thanks a lot, it worked like a charm for me  🙂

Ramakantha
Ramakantha
6 years ago

Hi,

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

fuz_ha
fuz_ha
6 years ago

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

Alexey
Alexey
6 years ago

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

Elsa
3 years ago

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 🙁

25
0
Would love your thoughts, please comment.x
()
x
Close Bitnami banner
Bitnami