Automatically build and release dotcore Huawei devcloud

Managed code creates a warehouse and submit project code

 

Then create a compiled build 

 

 Select the build tool build step Msbuild latest version of choice

powershell command: copy directly to the folder where I can not, so the execution powershell -Command cp -Force -r have to add the number of how many assemblies, packaged into the final document archive.zip

 

dotnet publish -c Release -o out
mkdir ./tmp
powershell -Command cp -Force -r ./Src/Project.Common/out/* ./tmp/
powershell -Command cp -Force -r ./Src/Project.Models/out/* ./tmp/
powershell -Command cp -Force -r ./Src/Project.DAL/out/* ./tmp/
powershell -Command cp -Force -r ./Project.Job.Core/out/* ./tmp/
powershell -Command cp -Force -r ./Src/Project.Rest.Core/out/* ./tmp/
powershell -Command cp -Force -r ./Src/Project.Mvc.Core/out/* ./tmp/
powershell -Command cp -Force -r ./Project.Job.Task/out/* ./tmp/
powershell -Command cp -Force -r ./Src/Project.Component/out/* ./tmp/
powershell -Command cp -Force -r ./Src/Project.Rest/out/* ./tmp/

powershell -Command Compress-Archive -Path ./tmp/* -DestinationPath ./archive.zip

  然后创建执行计划

保存信息 执行首次构建

 

 

下一步部署 新建一个任务

添加步骤

 

关闭连接池 和iis 站点,,不然发布会失败,也不能只关iis站点,

PowerShell命令:
C:\Windows\System32\inetsrv\appcmd.exe stop site rest.api
C:\Windows\System32\inetsrv\appcmd.exe stop apppool /apppool.name:rest.api

 

 

删除文件会把config 文件夹也删除,因为这个不是正式环境的配置,正式环境单独存放config 配置,在下一部操作拷贝回项目路径

配置完成测试发布

 

Guess you like

Origin www.cnblogs.com/liaokui/p/11277830.html
Recommended