From 7f9b53d336dc7a7f20c9924defd202a3ace7d668 Mon Sep 17 00:00:00 2001 From: Jimmy Byrd Date: Sat, 16 Nov 2024 11:18:18 -0500 Subject: [PATCH] Update contributing with BuildNet9 info --- CONTRIBUTING.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fb804438..a04b5ff2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,8 +2,30 @@ 1. Clone repo. 2. Install local tools with `dotnet tool restore` + +## 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.) + +### Against LTS (net8.0) +1. Run tests with `dotnet run --project .\build\ -- -t Test` + 1. This should chose the `Test:net9.0` target and run against that runtime + + +### Against STS (net9.0) +1. Change global.json to use net9.0 + ```json + "sdk": { + "version": "9.0.100", + "rollForward": "latestMinor", + "allowPrerelease": true + } + ``` +2. Set environment variable `BuildNet9` to `true` + 1. Bash: `export BuildNet9=true` + 2. PowerShell: `$env:BuildNet9 = "true"` 3. Run tests with `dotnet run --project .\build\ -- -t Test` -4. Create packages with `dotnet run --project .\build\ -- -t Pack` + 1. This should chose the `Test:net9.0` target and run against that runtime ## Release