Skip to content

Conversation

@ocalvo
Copy link

@ocalvo ocalvo commented Jan 14, 2026

Fixes #13017

Context

Implements local repo Sdk resolution

Changes Made

Add new local Sdk resolver

Testing

Add new unit tests

Notes

Copilot AI review requested due to automatic review settings January 14, 2026 17:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements support for repository-local MSBuild SDKs by adding a new RepoLocalSdkResolver that searches for SDKs in a .msbuild/Sdk/<SdkName>/ directory within the repository root. This allows projects to use custom SDKs located within their repository without requiring global installation.

Changes:

  • Added RepoLocalSdkResolver class that walks up the directory tree to find repository markers (.git, .hg, .svn) and searches for SDKs in .msbuild/Sdk/ directory
  • Registered the new resolver in SdkResolverLoader with higher priority (5000) than DefaultSdkResolver (10000) to allow repo-local SDKs to override global ones
  • Added comprehensive unit tests covering various scenarios including success cases, failure cases, and edge cases

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Build/Microsoft.Build.csproj Adds the new RepoLocalSdkResolver.cs file to the build
src/Build/BackEnd/Components/SdkResolution/SdkResolverLoader.cs Updates both GetDefaultResolvers() and LoadAllResolvers() to include the new RepoLocalSdkResolver before DefaultSdkResolver
src/Build/BackEnd/Components/SdkResolution/RepoLocalSdkResolver.cs New resolver implementation that finds repository root and searches for SDKs in .msbuild/Sdk/ directory
src/Build.UnitTests/BackEnd/RepoLocalSdkResolver_Tests.cs Comprehensive test suite covering all major scenarios for the new resolver

@ocalvo
Copy link
Author

ocalvo commented Jan 14, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Support for Repo‑Local MSBuild SDKs via .msbuild/Sdk/<SdkName>/

1 participant