Update odata-cli to target .NET 8 and .NET 10 - #449
Conversation
|
@microsoft-github-policy-service agree |
|
@gathogojr any chance on getting this merged? |
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFrameworks>net6.0</TargetFrameworks> |
There was a problem hiding this comment.
Targeting on .NET10 is enough?
There was a problem hiding this comment.
Your call. Right now .NET 8 and 9 is supported till Nov 10, 2026. I wanted to keep the currently supported LTS versions, but I don't mind making it .NET 10 only
There was a problem hiding this comment.
Pull request overview
This PR updates the odata-cli .NET tool to avoid startup failures on machines without a .NET 6 SDK by moving off net6.0 and improving MSBuild discovery/registration.
Changes:
- Multi-target
Microsoft.OData.CliandMicrosoft.OData.Cli.Teststonet8.0;net10.0, and bump the CLI package version to0.4.0. - Update MSBuild discovery by bumping
Microsoft.Build.Locatorto1.11.2and guarding registration withIsRegistered. - Fix test host MSBuild setup by adding a module initializer to register MSBuild before tests execute MSBuild APIs, and adjust package assets to avoid MSBuildLocator conflicts (MSBL001).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/Microsoft.OData.Cli.Tests/MSBuildRegistration.cs | Adds early MSBuild registration for tests via module initializer. |
| test/Microsoft.OData.Cli.Tests/Microsoft.OData.Cli.Tests.csproj | Multi-targets tests and aligns MSBuild-related package references for locator compatibility. |
| src/Microsoft.OData.Cli/Program.cs | Avoids double MSBuild registration by checking IsRegistered before RegisterDefaults(). |
| src/Microsoft.OData.Cli/Microsoft.OData.Cli.csproj | Multi-targets the CLI, bumps version, updates MSBuild locator, and avoids shipping conflicting runtime MSBuild/NuGet assemblies. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| namespace Microsoft.OData.Cli.Tests | ||
| { | ||
| /// <summary> | ||
| /// Registers the MSBuild assemblies from the running .NET SDK before any test exercises the |
|
@gathogojr @WanjohiSammy need just one more "yes" 🙂 |
Fixes #429
Fixes #324
Fixes #428
Fixes #448
odata-clitargetsnet6.0, which is out of support, so it crashes on startup with "No instances of MSBuild could be detected" when no net6 SDK is installed.Multi-targets the CLI (and its tests) to
net8.0;net10.0and bumpsMicrosoft.Build.Locatorto 1.11.2 so it locates the installed SDK's MSBuild. Also fixes the test project to register MSBuild — the part #432 missed that failed CI — and bumps the version to 0.4.0.Tests pass on net8.0 and net10.0, and the packed tool runs
generateon a .NET 8/10-only machine without the crash.