I'm trying to build and deploy ASP.NET Web application using GitHub actions and Azure.
I've successfully created and published to Azure a small app (.NET 4.8) using VS2017.
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.
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/[email protected]
- name: Setup NuGet
uses: NuGet/[email protected]
- 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. Now my publish to folder step looks something like this:
- name: Publish to folder
run: msbuild src\myproj\myproj.csproj ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With