2014年12月5日15:37:37 注意:值得一提的是此工具的运行环境,1,需要在你的服务器上安装svn。2,需要安装相应的vs编译器,如果你觉得太大,你可以选择安装相对于的window sdk for .net framework1、Auto_Build_EAS.bat@echo off @echo -------------------------@echo Only change variables belowset MSBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5set BuildType=Releaseset WorkingSpace=D:\workingspace\projects\shgt_erp\trunkset SourceDir=%WorkingSpace%\02-Sourcesset SolutionDir=%SourceDir%\N-EASset SolutionPath=%SolutionDir%\NI.EAS.All.slnset BinOutput=BinOutputrem cd to the folder of this commandpushd %~dp0@echo -------------------------@echo Start to get latest and build NI.EAS.All solution@echo Remove old log filesdel logs\ /Q /S /F@echo -------------------------@echo Get Lastest for %WorkingSpace%svn update %WorkingSpace%@echo Get Lastest Finished@echo -------------------------@echo Clear BinOutputdel %SolutionDir%\%BinOutput%\ /Q /S /F@echo Clear Binoutput Finished@echo -------------------------@echo Building Startcall %MSBuildDir%\msbuild %SolutionPath% /t:Rebuild /p:Configuration=%BuildType% >> logs\NI.EAS.log@echo Building Finsihed@echo -------------------------find "0 Error(s)" logs\NI.EAS.log && echo "no error" > logs\no_error.txtif exist logs\no_error.txt (goto succeed) else (goto failed):succeedcall Deploy.bat %SolutionDir%call Deploy_Jobs.bat %SourceDir% %BuildType%echo deploy succeedpauseexit:failedecho deploy failedpauseexit----------------------------------------------------------------------------2、Deploy.batset SolutionDir=%1set DestDir=D:\EASset ServiceDir=%SolutionDir%\Serviceset ServiceDestDir=%DestDir%\Serviceset PortalDir=%SolutionDir%\Portal\NI.EAS.Presentation.Webset PortalDestDir=%DestDir%\NI.EAS.Presentation.Webset APIDir=%SolutionDir%\Portal\NI.EAS.Presentation.APIset APIDestDir=%DestDir%\NI.EAS.Presentation.API@echo Backup the latest versiondel bak\ /Q /S /Fxcopy %DestDir%\*.* bak\ /S /Y /exclude:skipFiles.txt@echo Copy to destinationnet stop w3svcxcopy %ServiceDir%\*.* %ServiceDestDir%\ /S /D /Y /exclude:skipFiles.txtxcopy %PortalDir%\*.* %PortalDestDir%\ /S /D /Y /exclude:skipFiles.txtxcopy %APIDir%\*.* %APIDestDir%\ /S /D /Y /exclude:skipFiles.txtnet start w3svciisreset /restart----------------------------------------------------------------------------3、Auto_Build_Jobs.bat@echo off @echo -------------------------@echo Only change variables belowset MSBuildDir=%WINDIR%\Microsoft.NET\Framework\v3.5set BuildType=Releaseset WorkingSpace=D:\workingspace\projects\shgt_erp\trunkset SourceDir=%WorkingSpace%\02-Sourcesset SolutionDir=%SourceDir%\N-EASset SolutionPath=%SolutionDir%\NI.EAS.All.slnset BinOutput=BinOutputrem cd to the folder of this commandpushd %~dp0@echo -------------------------@echo Start to get latest and build NI.EAS.All solution@echo Remove old log filesdel logs\ /Q /S /F@echo -------------------------@echo Get Lastest for %WorkingSpace%svn update %WorkingSpace%@echo Get Lastest Finished@echo -------------------------@echo Clear BinOutputdel %SolutionDir%\%BinOutput%\ /Q /S /F@echo Clear Binoutput Finished@echo -------------------------@echo Building Startcall %MSBuildDir%\msbuild %SolutionPath% /t:Rebuild /p:Configuration=%BuildType% >> logs\NI.EAS.log@echo Building Finsihed@echo -------------------------find "0 Error(s)" logs\NI.EAS.log && echo "no error" > logs\no_error.txtif exist logs\no_error.txt (goto succeed) else (goto failed):succeedcall Deploy_Jobs.bat %SourceDir% %BuildType%echo compile succeedpauseexit:failedecho compile failedpauseexit------------------------------------------------------------------------------4.Deploy_Jobs.batset SourceDir=%1set BuildType=%2set FinancialJobDir=%SourceDir%\AutoInterfaceTask\InterfaceTask\TaskService\bin\%BuildType%set ScheduleJobDir=%SourceDir%\N-EAS\Jobs\NI.EAS.Jobs\bin\%BuildType%set FinancialJobDestDir=D:\ServiceRun\Debugset ScheduleJobDestDir=D:\Scheduler\bin\Release@echo Backup the latest versiondel bak_jobs\ /Q /S /Fxcopy %FinancialJobDestDir%\*.* bak_jobs\ServiceRun\ /S /Y /exclude:skipFiles.txtxcopy %ScheduleJobDestDir%\*.* bak_jobs\Scheduler\ /S /Y /exclude:skipFiles.txt@echo Copy to destinationrem net stop Financerem xcopy %FinancialJobDir%\*.* %FinancialJobDestDir%\ /S /D /Y /exclude:skipFiles.txtrem net start Financenet stop ERPSchedluerxcopy %ScheduleJobDir%\*.* %ScheduleJobDestDir%\ /S /D /Y /exclude:skipFiles.txtnet start ERPSchedluer