Skip to content

Build against the sibling library repos when the local workspace exists - #2

Merged
sadeqabuhattem merged 2 commits into
mainfrom
local-workspace-switch
Nov 6, 2026
Merged

sadeqabuhattem merged 2 commits into
mainfrom
local-workspace-switch

Conversation

@sadeqabuhattem

Copy link
Copy Markdown
Member

Summary

Lets this sample build against the DotNetBoost libraries' source on a machine that has the local workspace, and against nuget.org everywhere else.

Directory.Build.targets turns on only while ../DotNetBoost.Workspace.slnx exists. When it's on, each DotNetBoost.* package whose project is in a sibling repo's src/ folder (dotnetboost-settings, -media, -multilingual, -auditing) becomes a project reference. A library whose folder is missing stays a package.

  • CI is unaffected. It checks out this repo alone, so the file is never there, and builds keep using the versions pinned in Directory.Packages.props.
  • Works the same from the IDE, dotnet build, dotnet run and dotnet test, because it checks for the file rather than which solution is being built.
  • Opt out for one build: -p:UseLocalDotNetBoost=false. Delete the workspace file to turn it off for good.

Verification

  • In the workspace, every DotNetBoost library, including indirect ones, resolves as a local project, and the tests pass (160).
  • With -p:UseLocalDotNetBoost=false, they resolve as the nuget.org packages, and the tests still pass.
  • A copy of the repo outside the workspace (what CI sees) evaluates with the switch off and every package reference intact.

🤖 Generated with Claude Code

While ../DotNetBoost.Workspace.slnx exists, Directory.Build.targets turns
every DotNetBoost.* PackageReference whose project is in a sibling
repo's src/ folder (dotnetboost-settings, -media, -multilingual,
-auditing) into a ProjectReference to it. A library whose folder is
missing stays a package. Package ids equal project names in all four
repos, which is what the swap relies on.

It keys on the workspace file existing rather than $(SolutionFileName),
so `dotnet run --project` and the IDE behave the same as building the
workspace. CI checks out this repo alone, never has the file, and keeps
building against the packages pinned in Directory.Packages.props. One
build can opt out with -p:UseLocalDotNetBoost=false; deleting the
workspace file turns it off for good.

Verified: in the workspace, every DotNetBoost library (including the
transitive ones) resolves as a project and the tests (160) pass; with
the opt-out they resolve as the nuget.org packages and still pass; and
a copy of the repo outside the workspace evaluates with the switch off
and all seven Infrastructure package references intact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sadeqabuhattem
sadeqabuhattem merged commit 539e91f into main Nov 6, 2026
2 checks passed
@sadeqabuhattem
sadeqabuhattem deleted the local-workspace-switch branch November 6, 2026 18:51
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.

1 participant