as you can see in the title I have a C# BlazorWebApp with multiple projects and I want to release this solution to Azure via Github actions but it doesn't work.
To keep it small, I created a test-project for this and I have the same issue.
The structure of my test project:
I have one solution "MyBlazorWebApp" with two projects:
- "MyBlazorWebApp" as default Blazor-Web-App with test pages.
- "MyDBContext" as class library with one class "UserContext"
Class "UserContext":
namespace MyDBContext{ public class UserContext { public static string User { get; set; } = "MyUser"; }}Later, I want to use the class "UserContext" (stored in "MyDBContext") in "MyBlazorWebApp" and then releasing it to Azure.
Until now, there is no reference between these two projects.
To test everything I created a small Web Service ("TestBlazorWebsite") in Azure and then I created a deployment plan to create my .yml file in my github storage and release the first version.
My .yml file:
I changed these values:
- client-id to ${{ secrets.MyClientID }}
- tenant-id to ${{ secrets.MyTenantID }}
- subscription-id to ${{ secrets.MySubsciptionID }}
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy# More GitHub Actions for Azure: https://github.com/Azure/actionsname: Build and deploy ASP.Net Core app to Azure Web App - TestBlazorWebsiteon: push: branches: - master workflow_dispatch:jobs: build: runs-on: ubuntu-latest permissions: contents: read #This is required for actions/checkout steps: - uses: actions/checkout@v4 - name: Set up .NET Core uses: actions/setup-dotnet@v4 with: dotnet-version: '9.x' - name: Build with dotnet run: dotnet build --configuration Release - name: dotnet publish run: dotnet publish -c Release -o ${{env.DOTNET_ROOT}}/myapp - name: Upload artifact for deployment job uses: actions/upload-artifact@v4 with: name: .net-app path: ${{env.DOTNET_ROOT}}/myapp deploy: runs-on: ubuntu-latest needs: build environment: name: 'Production' url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} 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: .net-app - name: Login to Azure uses: azure/login@v2 with: client-id: ${{ secrets.MyClientID }} tenant-id: ${{ secrets.MyTenantID }} subscription-id: ${{ secrets.MySubsciptionID }} - name: Deploy to Azure Web App id: deploy-to-webapp uses: azure/webapps-deploy@v3 with: app-name: 'TestBlazorWebsite' slot-name: 'Production' package: .Until now, everything works fine.
So now I tried to add a project reference in "MyBlazorWebApp".project reference in "MyBlazorWebApp"
In this step I also changed the default home menu in "MyBlazorWebApp" to show the variable "User" in "UserContext". This variable is a string (= "MyUser") to test the output.
small changes in class "Home.razor"
And if I debug and test the project I get the expected output:Debugger output
But if I push the changes to github (and trigger the release to the website) I get this error message in github:
Run dotnet build --configuration Release/usr/share/dotnet/sdk/9.0.200/NuGet.targets(498,5): error MSB3202: The project file "/home/runner/work/MyDBContext/MyDBContext.csproj" was not found. [/home/runner/work/MyBlazorWebApp/MyBlazorWebApp/MyBlazorWebApp.sln]Build FAILED./usr/share/dotnet/sdk/9.0.200/NuGet.targets(498,5): error MSB3202: The project file "/home/runner/work/MyDBContext/MyDBContext.csproj" was not found. [/home/runner/work/MyBlazorWebApp/MyBlazorWebApp/MyBlazorWebApp.sln] 0 Warning(s) 1 Error(s)Time Elapsed 00:00:00.53Error: Process completed with exit code 1.The error occurs in this step from my .yml file:
- name: Build with dotnet run: dotnet build --configuration ReleaseMy "Release"-Build-Configuration:release configuration
I dont know why the project "DBContext" isn't found.Do you have any suggestions for me?
If you have any questions, dont hesitate to contact me.
KrSlowDown