[英]GitHub actions fails publishing to Azure
I'm trying to build and deploy ASP.NET Web application using GitHub actions and Azure.我正在尝试使用 GitHub 操作和 Z3A580F142203677F1FZ0BC308 构建和部署 ASP.NET Web 应用程序
I've successfully created and published to Azure a small app (.NET 4.8) using VS2017.我已经使用 VS2017 成功创建并发布到 Azure 一个小应用程序(.NET 4.8)。
Now I'm trying to setup automatic deployment and I'm using the basic GitHub actions workflow that you get from Azure when setting up deployment.现在我正在尝试设置自动部署,并且我正在使用您在设置部署时从 Azure 获得的基本 GitHub 操作工作流。
When running the action I get into this error:运行操作时出现此错误:
D:\a\pathtomyproject\myprojectname.csproj: error MSB4057: The target "pipelinePreDeployCopyAllFilesToOneFolder" does not exist in the project.
Here's the full action:这是完整的动作:
name: Build and deploy ASP app to Azure Web App
on:
push:
branches:
- develop
workflow_dispatch:
jobs:
build-and-deploy:
runs-on: 'windows-latest'
steps:
- uses: actions/checkout@master
- name: Setup MSBuild path
uses: microsoft/setup-msbuild@v1.0.2
- name: Setup NuGet
uses: NuGet/setup-nuget@v1.0.5
- name: Restore NuGet packages
run: nuget restore
- name: Publish to folder
run: msbuild /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="\published\"
- name: Deploy to Azure Web App
uses: azure/webapps-deploy@v2
with:
app-name: 'myname'
slot-name: 'production'
publish-profile: ${{ ... }}
package: \published\
Specifically, the error occurs during "Publish to folder" step.具体来说,错误发生在“发布到文件夹”步骤中。
Found the solution to my problem.找到了我的问题的解决方案。 Since I was using multi project solution, I had to modify msbuild command and specify to build my startup project.由于我使用的是多项目解决方案,我不得不修改 msbuild 命令并指定构建我的启动项目。 Now my publish to folder step looks something like this:现在我的发布到文件夹步骤如下所示:
- name: Publish to folder
run: msbuild src\myproj\myproj.csproj ...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.