I’m currently trying to set up a GitHub actions such that when a PR is made to the developing branch, a series unit test runs on the PR. This is a dotnet application, and here is the dot.yml:
name: .NET
on:
push:
branches: [ "developing" ]
pull_request:
branches: [ "developing" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
Here is how the project is structured:
When I test out the actions it fails, and I get the following message:
Run dotnet restore
C:Program Filesdotnetsdk8.0.302NuGet.targets(414,5): error MSB3202: The project file "D:aprojectUnitTestUnitTest.csproj" was not found. [D:aprojectprojectproject.sln]
Error: Process completed with exit code 1.
I’m not sure how to resolve this, the UnitTest folder is in the project, and it is only in the developing branch, it is not in the Main branch. I have tried adding run: dotnet restore project/ but that didn’t help. Searching online for solution told me that the file name could be too long, but I don’t think that’s the case with my project. When I run dotnet restore locally everything works. Any idea what I should do?