Deploy .NET Core application with AppVeyor: file is locked by an external process (Appveyor agent)

I am trying to deploy a project to a server using the Appveyor agent. However, if I do not restart or stop the application before deployment, it does not work.

Web Deploy cannot modify the file 'TestProject.Application.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. 

Is there an easy way to work with the app_offline.htm file? Configuring appveyor.yml using the app_offline function does not work in this environment.

I was looking for something in the before / after section. Here is my appveyor.yml:

 version: '1.0.{build}' os: Visual Studio 2015 install: - "SET PATH=C:\\Program Files\\dotnet\\bin;%PATH%" branches: only: - master assembly_info: patch: true file: '**\AssemblyInfo.*' assembly_version: '{version}' assembly_file_version: '{version}' assembly_informational_version: '{version}' build_script: - nuget sources add -name "VNext" -source https://dotnet.myget.org/F/cli-deps/api/v3/index.json - nuget sources add -name "nugetv3" -source https://api.nuget.org/v3/index.json - dotnet restore - dotnet build */*/project.json after_build: - ps: Remove-Item -Path src\TestProject.Web\web.config - ps: Move-Item -Path src\TestProject.Web\web.$env:APPVEYOR_REPO_BRANCH.config -Destination src\TestProject.Web\web.config - dotnet publish src\TestProject.Web\ --output %appveyor_build_folder%\publish artifacts: - path: .\publish name: TestProject.Web test: off deploy: - provider: Environment name: east-webhost artifact: TestProject.Web remove_files: false on: branch: master 
+5
source share
1 answer

Look before / after deploying scripts . Also check out this example on how you can ensure that a file is released.

- ilya.

+2
source

Source: https://habr.com/ru/post/1259059/


All Articles