From fcc2646c25c9dcc9803395167d6221708e2ed7aa Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 18 Nov 2024 16:39:05 -0600 Subject: [PATCH] Update CONTRIBUTING.md --- CONTRIBUTING.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a04b5ff..00d92fc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,14 @@ ## Testing -Testing against different .NET runtimes is a bit of a chore because we want to let the runtime load the current runtime's Microsoft.Build assemblies. Unfortunately, we can't have the `global.json` set to `net9.0` because the `Microsoft.Build` assemblies are compatible with the .NET 9 runtime, and will try to load them, even in a net8.0 TFM context. (Chet to fill in longer description as to why.) +Testing against different .NET runtimes is a bit of a chore because we want to let the runtime load the current runtime's Microsoft.Build assemblies. Unfortunately, we can't have the `global.json` set to `net9.0` because the `Microsoft.Build` assemblies are compatible with the .NET 9 runtime, and will try to load them, even in a net8.0 TFM context. + +Our current algorithm is + +* run `dotnet --version` in the workspace directory +* use the output of that to determine which SDK to load from + +So if you set global.json to a 9.0.xxx SDK, you'll _always_ use the 9.x MSBuild libraries, which will require the 9.0 runtime to load. If you want to test while loading older MSBuilds, you'll need to somehow constraint the tests to 8.0.xxx SDKs, and the easiest way to do this is to make a global.json with a 8.0.xxx version and a `rollForward: latestPatch` constraint on it. ### Against LTS (net8.0) 1. Run tests with `dotnet run --project .\build\ -- -t Test`