Skip to content

Commit d42f60b

Browse files
Fix copilot-setup workflow by explicitly specifying solution file in dotnet commands (#837)
## Problem The `copilot-setup` workflow was failing with the following error: ``` Run dotnet restore MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file. Error: Process completed with exit code 1. ``` ## Root Cause The `dotnet restore` and `dotnet build` commands in the GitHub Actions workflows were not explicitly specifying which solution file to use. While the repository root contains only one solution file (`EssentialCSharp.sln`), MSBuild in certain environments—particularly with newer .NET SDK versions or specific GitHub Actions runner configurations—requires an explicit solution/project file specification to avoid ambiguity. ## Solution Updated both affected workflow files to explicitly specify the solution file: 1. **`.github/actions/setup-dotnet/action.yml`** - Modified the composite action to specify `EssentialCSharp.sln`: - `dotnet restore` → `dotnet restore EssentialCSharp.sln` - `dotnet build --no-restore` → `dotnet build EssentialCSharp.sln --no-restore` 2. **`.github/workflows/LocalesTest.yml`** - Applied the same fix for consistency: - `dotnet restore` → `dotnet restore EssentialCSharp.sln` - `dotnet build --no-restore` → `dotnet build EssentialCSharp.sln --no-restore` ## Testing Verified the fix locally by running: - `dotnet restore EssentialCSharp.sln` - Completed successfully - `dotnet build EssentialCSharp.sln --no-restore` - Completed successfully with 114 warnings, 0 errors - `dotnet test --no-build --no-restore --verbosity normal` - Tests ran successfully This is a best practice that makes the workflows more explicit and robust across different environments and .NET SDK versions. > [!WARNING] > > <details> > <summary>Firewall rules blocked me from connecting to one or more addresses (expand for details)</summary> > > #### I tried to connect to the following addresses, but was blocked by firewall rules: > > - `google.com` > - Triggering command: `/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net8.0/Chapter05.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net8.0/Chapter05.Tests.deps.json /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net8.0/testhost.dll --port 37959 --endpoint 127.0.0.1:037959 --role client --parentprocessid 6060 --telemetryoptedin false` (dns block) > - Triggering command: `/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net7.0/Chapter05.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net7.0/Chapter05.Tests.deps.json /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net7.0/testhost.dll --port 37433 --endpoint 127.0.0.1:037433 --role client --parentprocessid 6096 --telemetryoptedin false` (dns block) > - Triggering command: `/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net6.0/Chapter05.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net6.0/Chapter05.Tests.deps.json /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net6.0/testhost.dll --port 38517 --endpoint 127.0.0.1:038517 --role client --parentprocessid 6132 --telemetryoptedin false` (dns block) > - `intellitect.com` > - Triggering command: `/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net8.0/Chapter05.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net8.0/Chapter05.Tests.deps.json /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net8.0/testhost.dll --port 37959 --endpoint 127.0.0.1:037959 --role client --parentprocessid 6060 --telemetryoptedin false` (dns block) > - Triggering command: `/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net7.0/Chapter05.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net7.0/Chapter05.Tests.deps.json /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net7.0/testhost.dll --port 37433 --endpoint 127.0.0.1:037433 --role client --parentprocessid 6096 --telemetryoptedin false` (dns block) > - Triggering command: `/usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net6.0/Chapter05.Tests.runtimeconfig.json --depsfile /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net6.0/Chapter05.Tests.deps.json /home/REDACTED/work/EssentialCSharp/EssentialCSharp/src/Chapter05.Tests/bin/Debug/net6.0/testhost.dll --port 38517 --endpoint 127.0.0.1:038517 --role client --parentprocessid 6132 --telemetryoptedin false` (dns block) > > If you need me to access, download, or install something from one of these locations, you can either: > > - Configure [Actions setup steps](https://gh.io/copilot/actions-setup-steps) to set up my environment, which run before the firewall is enabled > - Add the appropriate URLs or hosts to the custom allowlist in this repository's [Copilot coding agent settings](https://github.com/IntelliTect/EssentialCSharp/settings/copilot/coding_agent) (admins only) > > </details> <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > our copilot-setup workflow failed with this: > > Prepare all required actions > Getting action download info > Download action repository 'actions/setup-dotnet@v5' (SHA:d4c94342e560b34958eacfc5d055d21461ed1c5d) > Run ./.github/actions/setup-dotnet > Run actions/setup-dotnet@v5 > (node:2171) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. > (Use `node --trace-deprecation ...` to show where the warning was created) > /home/runner/work/_actions/actions/setup-dotnet/v5/externals/install-dotnet.sh --skip-non-versioned-files --runtime dotnet --channel LTS > dotnet-install: .NET Core Runtime with version '8.0.20' is already installed. > /home/runner/work/_actions/actions/setup-dotnet/v5/externals/install-dotnet.sh --skip-non-versioned-files --channel 8.0 > dotnet-install: .NET Core SDK with version '8.0.414' is already installed. > /home/runner/work/_actions/actions/setup-dotnet/v5/externals/install-dotnet.sh --skip-non-versioned-files --runtime dotnet --channel LTS > dotnet-install: .NET Core Runtime with version '8.0.20' is already installed. > /home/runner/work/_actions/actions/setup-dotnet/v5/externals/install-dotnet.sh --skip-non-versioned-files --channel 9.0 > dotnet-install: .NET Core SDK with version '9.0.305' is already installed. > Run dotnet restore > MSBUILD : error MSB1011: Specify which project or solution file to use because this folder contains more than one project or solution file. > Error: Process completed with exit code 1. </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ) to start the survey. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: BenjaminMichaelis <[email protected]>
1 parent 81b13c8 commit d42f60b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

.github/actions/setup-dotnet/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ runs:
3030
3131
- name: Restore dependencies
3232
shell: bash
33-
run: dotnet restore
33+
run: dotnet restore EssentialCSharp.sln
3434

3535
- name: Build
3636
if: ${{ inputs.build == 'true' }}
3737
shell: bash
38-
run: dotnet build --no-restore
38+
run: dotnet build EssentialCSharp.sln --no-restore

.github/workflows/LocalesTest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
echo "Printing date"
5252
date
5353
echo Restore dependencies
54-
dotnet restore
54+
dotnet restore EssentialCSharp.sln
5555
echo Build
56-
dotnet build --no-restore
56+
dotnet build EssentialCSharp.sln --no-restore
5757
echo Test
5858
dotnet test --no-build --no-restore --verbosity normal

0 commit comments

Comments
 (0)