From 8cade32be7a70289e54f1739ca16f8bff4e67106 Mon Sep 17 00:00:00 2001 From: Sadeq Abu-Hattem Date: Thu, 5 Nov 2026 21:12:47 +0200 Subject: [PATCH] Build against the sibling library repos when the local workspace exists 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 --- Directory.Build.targets | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Directory.Build.targets diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 0000000..d213721 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,43 @@ + + + + + + $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..'))/ + true + + + + + <_DotNetBoostLocalProject Include="$(DotNetBoostWorkspaceRoot)dotnetboost-settings/src/DotNetBoost.*/*.csproj; + $(DotNetBoostWorkspaceRoot)dotnetboost-media/src/DotNetBoost.*/*.csproj; + $(DotNetBoostWorkspaceRoot)dotnetboost-multilingual/src/DotNetBoost.*/*.csproj; + $(DotNetBoostWorkspaceRoot)dotnetboost-auditing/src/DotNetBoost.*/*.csproj" + ProjectPath="%(FullPath)" /> + <_DotNetBoostLocalId Include="@(_DotNetBoostLocalProject->'%(Filename)')" /> + + + <_DotNetBoostUnreferenced Include="@(_DotNetBoostLocalId)" /> + <_DotNetBoostUnreferenced Remove="@(PackageReference)" /> + <_DotNetBoostSwapped Include="@(_DotNetBoostLocalId)" /> + <_DotNetBoostSwapped Remove="@(_DotNetBoostUnreferenced)" /> + + + + + +