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.
Open the property of your project and go to Build Events.
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.
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