2016-10-31 47 views
5

我試圖在使用Appveyor代理的服務器上部署項目。但是,如果我在部署之前不重新啓動或停止應用程序,則不起作用。通過AppVeyor部署.NET Core應用程序:文件被外部進程鎖定(Appveyor代理)

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. 

有沒有一種簡單的方法來處理app_offline.htm文件?使用「app_offline」功能的appveyor.yml配置在這種環境下不起作用。

我正在尋找「之前/之後」部分的內容。這裏是我的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 

回答

2

請看before/after deploy scripts。還請檢查this sample如何確保發佈文件。

--ilya。

+0

我在我的項目的根目錄下有我的before-deploy.ps1,但它沒有執行,對此有任何想法? /deploy.ps1 /src/TestProject.WebApp 我將這個deploy.ps1作爲「解決方案項目」包含在我的解決方案中。 服務器上仍然沒有執行任何操作。 –

+3

http://www.gabrielrobert.com/2016/11/blog-post.html –