Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying multi-project ASP.NET Core web app to Azure App Service using Github Actions

I'm setting up a new ASP.NET Core (version 3.1) web app. I have it hosted on Github and deployed to Azure App Service using Github Actions.

The deployment worked fine as long as I had a single project in the solution (the main ASP.NET Core project).

When I added a test project and set PROJECT=helloworld/helloworld.csproj in App Service configuration (as advised in documentation and also on a blog I found on the Internet), the deployment started to fail.

The Github Actions failure message says I should refer to logs for more details. I don't know where to get these logs.

The structure of my repository:

- helloworld (sln directory)
  - helloworld.sln
  - helloworld (main asp.net core project directory)
    - helloworld.csproj
  - tests
    - helloworld.tests (test project directory)
      - helloworld.tests.csproj

The Github Actions workflow definition is the basic one which was auto-generated when setting up the App Service:

...
- name: dotnet publish
  run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp

- name: Deploy to Azure Web App
  uses: azure/webapps-deploy@v1
  with:
    app-name: 'helloworld'
    slot-name: 'production'
    publish-profile: ${{ secrets.AzureAppService_PublishProfile_6941d41e13284fa890c1c34ffa8674e0 }}
    package: ${{env.DOTNET_ROOT}}/myapp 
like image 713
Dušan Rychnovský Avatar asked Sep 02 '25 10:09

Dušan Rychnovský


1 Answers

The PROJECT setting can be used if you publish your sources to the AppService, and let it build and run the project. Your workflow is building and the code using Github Actions, so you just publish the compiled result. What you need to do is publish the desired project. Should look something like this:

- name: dotnet publish
  run: dotnet publish helloworld/helloworld.csproj -c Release -o ${{env.DOTNET_ROOT}}/myapp

like image 110
Alex AIT Avatar answered Sep 04 '25 23:09

Alex AIT