简体   繁体   English

GitHub 操作无法发布到 Azure

[英]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.

相关问题 将Web应用程序发布到Azure网站登台部署插槽失败,并显示webjob - Publishing web app to Azure Websites Staging deployment slot fails with webjob 在Azure中发布 - Publishing in Azure 使用 Github 发布 React+dotnet 核心应用程序引发错误 MSB3073 的操作:命令“npm run build”退出,代码为 1 - Publishing React+dotnet core application using Github Actions throwing error MSB3073: The command “npm run build” exited with code 1 Azure 应用服务部署中心无法从 GitHub 存储库部署 - Azure App Service Deployment Centre fails to deploy from GitHub repo 在命令行中将ASP.Net Core应用程序发布到Azure静默失败 - Publishing ASP.Net Core app to Azure silently fails in command line 发布网站某些页面失败 - Publishing Website fails for some pages 将脚手架网站发布到蔚蓝 - Publishing scaffolded web site to azure 在Azure上发布后的日期问题 - Issue with dates after publishing on azure NullReferenceException发布ASP.Net Core失败 - Publishing ASP.Net Core Fails with NullReferenceException 发布到Azure之前清理/重建解决方案 - Clean/Rebuild Solution Before Publishing To Azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM