Reputation: 4397
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://learn.microsoft.com/en-gb/azure/app-service/configure-language-dotnetcore?pivots=platform-linux#deploy-multi-project-solutions
What's happening is that Azure is randomly selecting one of my web apps each time I deploy.
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: 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?
Upvotes: 4
Views: 1228
Reputation: 4397
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
Upvotes: 5