释放双眼,带上耳机,听听看~!
由于 .net 下的程序很容易被反编译,发布软件之前需要对代码进行混淆。
从拉取代码,编译到最后的混淆步骤很多。这时就可以使用批处理来进行自动化。
用到的软件:TortoiseSVN, VS2013 , Dotfuscator Professional Edition
前置条件:提前使用dotfuscator进行一次混淆,并合理存放工程文件,设置混淆前后目录。
在编译之前批处理程序会先删除原先的编译结果,这样在编译出错时会发现文件缺失。
::拉取svn \"D:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe\" /command:update /path:\"D:\\MySVN\\Compile\" /closeonend:1 ::删除文件 set filepath1=\"D:\\MySVN\\Compile\\MyApp1\\OutPut\\Release\\MyApp1Back.exe\" set filepath2=\"D:\\MySVN\\Compile\\MyApp1\\OutPut\\Release\\MyApp1Front.exe\" set filepath3=\"D:\\MySVN\\Compile\\MyApp1\\OutPut\\Release\\MyApp1Basic.dll\" del /q %filepath1% del /q %filepath2% del /q %filepath3% ::编译 set vspath=\"D:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE\\devenv.exe\" set slnpath=\"D:\\MySVN\\Compile\\MyApp1\\MyApp1.sln\" %vspath% /rebuild Release %slnpath% ::复制文件 set outpath1=\"C:\\Users\\11320\\Desktop\\MyApp1混淆\\before\\MyApp1Back.exe\" set outpath2=\"C:\\Users\\11320\\Desktop\\MyApp1混淆\\before\\MyApp1Front.exe\" set outpath3=\"C:\\Users\\11320\\Desktop\\MyApp1混淆\\before\\MyApp1Basic.dll\" copy %filepath1% %outpath1% @IF %errorlevel%==1 echo \"编译出错,文件不存在。\"&goto End copy %filepath2% %outpath2% @IF %errorlevel%==1 echo \"编译出错,文件不存在。\"&goto End copy %filepath3% %outpath3% @IF %errorlevel%==1 echo \"编译出错,文件不存在。\"&goto End ::混淆 set dotfuscatorpath=\"C:\\Program Files (x86)\\PreEmptive Solutions\\Dotfuscator Professional Edition 4.9\\dotfuscator\" set xmlpath=\"C:\\Users\\11320\\Desktop\\MyApp1Basic混淆\\temp\\MyApp1Basic混淆.xml\" %dotfuscatorpath% /v %xmlpath% :End pause