I created a basic ASP.NET Razor pages project called learningapptest.
Then I created a github repository called learningapptest.
I then pushed up my basic ASP.NET project to github. In the Azure Portal, I went to my basic web app.
I selected deployment center, I picked GitHub as the source, I made sure I was signed in.
I selected Erikw343 as the organization, and selected learningapptest as the repository; I selected main as the branch.
I took the rest as the defaults and clicked save.
Then, I got this error message:
Run nuget restore
The folder 'D:\a\learningapptest\learningapptest' does not contain an msbuild solution or packages.config file to restore.
Error: Process completed with exit code 1
Although, my project does have a packages.config file!
This is my main_learningapperik.yml file:
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP app to Azure Web App - learningapperik
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- 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: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: ASP-app
path: '/published/**'
deploy:
runs-on: windows-latest
needs: build
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: ASP-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_F6348B2E31F94008973B341661415A87 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_6F3985F493BC43D09123DC142720057F }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_8BE450D5FE7840ECB96C8E7C3E95A8A4 }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'learningapperik'
slot-name: 'Production'
package: .
This is a link to my public GitHub learningapptest project: https://github.com/erikw343/learningapptest
look here for the failed actions: https://github.com/erikw343/learningapptest/actions
I changed my YAML file to this, and it fixed the build errors, but now I have deploy errors:
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Build and deploy ASP app to Azure Web App - learningapperik
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
permissions:
contents: read #This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- name: Setup MSBuild path
uses: microsoft/[email protected]
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Restore NuGet packages
run: nuget restore learningapptest/learningapptest.sln
- name: Publish to folder
run: msbuild learningapptest/learningapptest.sln /nologo /verbosity:m /t:Build /p:_PackageTempDir="\published\"
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v4
with:
name: ASP-app
path: '/published/**'
deploy:
runs-on: windows-latest
needs: build
permissions:
id-token: write #This is required for requesting the JWT
contents: read #This is required for actions/checkout
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v4
with:
name: ASP-app
- name: Login to Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_F6348B2E31F94008973B341661415A87 }}
tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_6F3985F493BC43D09123DC142720057F }}
subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_8BE450D5FE7840ECB96C8E7C3E95A8A4 }}
- name: Deploy to Azure Web App
id: deploy-to-webapp
uses: azure/webapps-deploy@v3
with:
app-name: 'learningapperik'
slot-name: 'Production
My new issue now is this:
Run actions/download-artifact@v4
with:
name: ASP-app
merge-multiple: false
repository: erikw343/learningapptest
run-id: 19995715081
Downloading single artifact
Error: Unable to download artifact(s): Artifact not found for name: ASP-app
Please ensure that your artifact is not expired and the artifact was uploaded using a compatible version of toolkit/upload-artifact.
For more information, visit the GitHub Artifacts FAQ: https://github.com/actions/toolkit/blob/main/packages/artifact/docs/faq.md