question

Owen-5182 avatar image
1 Vote"
Owen-5182 asked ryanchill commented

How to deploy a .NET Core solution with multiple web apps to Azure using Github Actions

I've got a .NET Core 3.1 solution with 10 projects, 4 of them are web apps.

I hooked up my Azure App Service to GitHub so that every time I publish or click 'Sync' under 'Deployment Center', my code in GitHub will be transferred to my App Service.

According to this document, Azure takes the first web app it comes across and uses it as the default: https://docs.microsoft.com/en-gb/azure/app-service/configure-language-dotnetcore?pivots=platform-linux#deploy-multi-project-solutions

I did exactly what the document said and set an Application Setting in my App Service Configuration to:
Name: PROJECT
Value: projectName/projectName.csproj

This question from 5 years ago is about the same problem, but the solution says to do what the above article says, only exclude the projectName.csproj: https://stackoverflow.com/questions/36270956/azure-deployment-source-choose-startup-project-to-build

Both solutions give me the same kind of error under GitHub Actions:
Error: Could not find a part of the path 'C:\local\Temp\zipdeploy\extracted\projectName'

I've gone into the above 'extracted' directory, and it can't find 'projectName' because the file structure is pretty much flat and all my projects are in there as DLLs and EXEs. Basically the folder structure isn't the same as my local and projects are no longer in their own folders.

How can I do this?

azure-webappsdotnet-aspnet-core-blazor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Owen-5182 avatar image
1 Vote"
Owen-5182 answered ryanchill commented

Figured out the answer by creating a yaml from Visual Studio publish and comparing it with GitHub's yaml.

This is a section of the workflow that Azure creates for GitHub:

 - name: Build with dotnet
       run: dotnet build --configuration Release
 - name: dotnet publish
       run: dotnet publish -c Release -o ${<!-- -->{env.DOTNET_ROOT}}/myapp

I added the project name after build and publish:

 - name: Build with dotnet
       run: dotnet build PROJECT_NAME --configuration Release
 - name: dotnet publish
       run: dotnet publish PROJECT_NAME -c Release -o ${<!-- -->{env.DOTNET_ROOT}}/myapp




· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Glad you were able to resolve your issue @Owen-8253 and adding it to benefit the community.

1 Vote 1 ·