Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -690,10 +690,38 @@ jobs:
10.0.x

- name: Restore dependencies
run: dotnet restore
# Discover the solution file explicitly rather than relying on dotnet's
# implicit cwd resolution. This fixes:
# - MSB1003 ("Specify a project or solution file") in repos whose
# solution lives in a subfolder (e.g. console-app-template's
# src/ConsoleAppTemplate.sln) — bare 'dotnet restore' fails because
# the repo root has no solution.
# - MSB1011 ("Specify which project or solution file to use") in
# repos with multiple solution files at root.
# Preference order: .slnx (newer XML-based format) → .sln. Among multiple
# candidates of the same extension, pick the alphabetically-first.
shell: bash
run: |
sln=$(git ls-files '*.slnx' | head -1)
[ -z "$sln" ] && sln=$(git ls-files '*.sln' | head -1)
if [ -n "$sln" ]; then
echo "Discovered solution: $sln"
dotnet restore "$sln"
else
echo "ℹ️ No solution file found — falling back to bare 'dotnet restore'."
dotnet restore
fi

- name: Build solution
run: dotnet build --no-restore --configuration Release
shell: bash
run: |
sln=$(git ls-files '*.slnx' | head -1)
[ -z "$sln" ] && sln=$(git ls-files '*.sln' | head -1)
if [ -n "$sln" ]; then
dotnet build "$sln" --no-restore --configuration Release
else
dotnet build --no-restore --configuration Release
fi

- name: Run all .NET tests (.NET 5.0-10.0 and Framework 4.6.2-4.8.1)
shell: pwsh
Expand Down
Loading