fix: .NET SDK detection with Homebrew installations on macOS#503
fix: .NET SDK detection with Homebrew installations on macOS#503Copilot wants to merge 2 commits into
Conversation
|
|
|
@copilot In CI, with the new test, we can see that the system path for .NET is being used: |
The CI test wasn't properly simulating the Homebrew scenario - the GitHub Actions runner comes with .NET pre-installed in Fixed in commit 8958dfe:
|
|
@copilot Now, the build is failing with: |
The nbgv tool requires a working .NET runtime to execute. After removing Fixed in commit 12bbdcf by reordering the CI steps:
This ensures nbgv completes before we manipulate the .NET installation. |
|
@copilot It's still failing: |
The uno-check tool was installed to Fixed in commit c79c5c6:
This allows the tools to run while still testing the Homebrew scenario. |
|
@copilot Uno.check still installs .NET in the wrong folder: |
The issue was that Fixed in commit 8b37bb1:
Now uno-check will respect the Homebrew environment set in CI and install SDKs to |
|
@copilot The homebew test is installing .NET 9 .github/workflows/ci.yml:261 and should be .NET 10. |
Fixed in commit 0b6786f:
The test now installs .NET 10 via Homebrew to match the preview-major manifest requirements. |
|
@copilot homebrew is still installing .NET 9: |
Fixed in commit b87ffa2:
The tap provides casks for specific .NET SDK versions that aren't available in Homebrew's main formula. |
|
@copilot Thid time, here's the build output: |
Fixed in commit 1f67eb1:
The cask installs to a different location than the Homebrew formula, so we now detect and use the correct path. |
|
@copilot It looks like .NET 10 is not installed properly by homebrew. |
Added debugging in commit 6cf52ba to diagnose the installation issue:
The issue appears to be that the cask may not install files to |
|
@copilot It's now installed, but the next step fails: |
Fixed in commit 58b66a1:
Now |
|
@copilot Great, now the problem is that if a user installed using formula, we're going to fail again, let's make if obvious that .NET should be installed using cask. |
Fixed in commit c14d1df:
Now if someone installs via formula, the test will fail immediately with: |
|
@copilot We need to change the dotnet sdk checks inside uno.check, not the CI. We can keep the cask install in CI to make it testable, but the users should not be using forumla. |
Fixed in commit f2292b7:
Users will now see: |
f2292b7 to
16daa22
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes .NET SDK detection issues when .NET is installed via Homebrew on macOS. The root cause was that uno-check installed SDKs to ~/.dotnet, but Homebrew's dotnet --list-sdks only detected Homebrew-managed SDKs, causing repeated installation attempts.
Changes:
- Enhanced detection to recognize Homebrew installation paths (
/opt/homebrew/bin/dotnetfor Apple Silicon and/Cellar/dotnet/for all Homebrew installs) - Modified installation logic to detect Homebrew locations and install to
~/.dotnetinstead, then updateDOTNET_ROOTfor subsequent checks - Added user warnings when .NET is installed via Homebrew formula (as opposed to cask), since formula installations don't properly detect SDKs in
~/.dotnet - Added comprehensive CI test matrix entry that validates the Homebrew cask installation scenario
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| UnoCheck/Solutions/DotNetSdkScriptInstallSolution.cs | Added Homebrew location detection to avoid installing to Homebrew-managed directories, and updates DOTNET_ROOT after installation |
| UnoCheck/DotNet/DotNetSdk.cs | Added new macOS dotnet locations for Homebrew and ~/.dotnet, plus Homebrew detection logic to preserve Homebrew DOTNET_ROOT |
| UnoCheck/Checkups/DotNetCheckup.cs | Added warning message to alert users about Homebrew formula installations and recommend cask or dotnet-install.sh |
| .github/workflows/ci.yml | Added Homebrew scenario test matrix entry with detailed setup and verification steps |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
When .NET is installed via Homebrew on macOS, uno-check's install script installs missing SDKs to
~/.dotnet, but subsequent checks fail because Homebrew'sdotnet --list-sdksonly sees Homebrew-managed SDKs.Changes Made
Detection
/opt/homebrew/bin/dotnetand~/.dotnetto known macOS locations/opt/homebrew) and Intel (/usr/local/Cellar) Homebrew pathsInstallation
/opt/homebrew,/Cellar/dotnet/) and install to~/.dotnetinsteadDOTNET_ROOTpost-install to ensure subsequent checks query the correct dotnet executableUser Warning
brew install dotnet)~/.dotnetby uno-checkbrew install --cask dotnet-sdkX-X-XXX) or dotnet-install.sh insteadValidation
Testing
The changes ensure uno-check works correctly with Homebrew installations while warning users about problematic formula installations.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.