Skip to content

Implements support for Repo‑Local MSBuild SDKs via .msbuild/Sdk/<SdkName>/#13027

Closed
ocalvo wants to merge 13 commits into
dotnet:mainfrom
ocalvo:main
Closed

Implements support for Repo‑Local MSBuild SDKs via .msbuild/Sdk/<SdkName>/#13027
ocalvo wants to merge 13 commits into
dotnet:mainfrom
ocalvo:main

Conversation

@ocalvo

@ocalvo ocalvo commented Jan 14, 2026

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread src/Build/BackEnd/Components/SdkResolution/RepoLocalSdkResolver.cs Outdated
Comment thread src/Build/BackEnd/Components/SdkResolution/RepoLocalSdkResolver.cs Outdated
ocalvo and others added 2 commits January 14, 2026 10:13
…r.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…r.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ocalvo

ocalvo commented Jan 14, 2026

Copy link
Copy Markdown
Author

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

@JanProvaznik

Copy link
Copy Markdown
Member

we don't want to widen the surface area for extensibility discovery

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>/

4 participants