开发日记:DotNetCore 批处理 发布

@echo off
@title 中医科院 - 发布
@echo ******************************************************
@echo ===============通过命令dotnet publish进行发布=========
@echo 1.svn_home 安装TortoiseSVN的目录
@echo 2.sourcecode_dirs 源码路径
@echo 3.publish_dirs 发布路径
@echo 4.backups_dirs 备份路径
@echo ******************************************************

@echo **********************正在准备变量********************
set YYYYmmdd=%date:~0,4%%date:~5,2%%date:~8,2%
set svn_home=C:Program FilesTortoiseSVNin
set sourcecode_dirs=C:Src
set publish_dirs=C:inetpubwwwroothdj_zyykq
set backups_dirs=C:ackupshdj_zyykq_%YYYYmmdd%
@md %backups_dirs%

@echo 1.SVN路径=%svn_home%
@echo 2.源码路径=%sourcecode_dirs%
@echo 3.发布路径=%publish_dirs%
@echo 4.备份路径=%backups_dirs%

@echo **********************备份站点**********************
xcopy.exe %publish_dirs% %backups_dirs% /e/r/h/y

@echo **********************正在更新源码**********************
for %%c in (%sourcecode_dirs%) do "%svn_home%"TortoiseProc.exe/command:update /path:"%%c" /notempfile /closeonend:2

@echo **********************正在发布**************************
cd %sourcecode_dirs%
dotnet publish -c Release -o %publish_dirs%
@md %publish_dirs%logs
xcopy.exe C:HDJSrchdj_zyykqBuildconfig elease %publish_dirs% /e/r/h/y

@echo **********************重启站点**************************
net stop was /y
net start w3svc

@echo ===============发布完成,自动退出=======================

@pause
@exit

原文地址:https://www.cnblogs.com/luomingui/p/11159908.html