Search code examples
asp.net-mvc-2dlldotfuscator

How to automate Dotfuscator in build


I have to protect some dll in my mvc2 project in visual studio 2010. I'm using Dotfuscator and i want to automate it in build process. I refer the following article but I have no idea how to implement it. http://msdn.microsoft.com/en-us/library/hh977082(v=vs.107).aspx


Solution

  • We do this by creating a .proj file (MSBuild.exe) and call it directly using exec.

    <Exec Command='"$(OBFU_HOME)\dotfuscator.exe" dotfuscator.xml'/>
    <Exec Command='"$(SN_HOME)\sn.exe" -R filename.dll filename.snk'/>
    

    OBFU_HOME & SN_HOME are set in the environment. Make sure you call sn.exe after as the dll needs to be re-signed.

    Will this work for you? If not, then you need to put it in the post build event handler.