Skip to content

Update odata-cli to target .NET 8 and .NET 10#449

Open
aboryczko wants to merge 1 commit into
OData:masterfrom
aboryczko:feature/odata-cli-net8-net10
Open

Update odata-cli to target .NET 8 and .NET 10#449
aboryczko wants to merge 1 commit into
OData:masterfrom
aboryczko:feature/odata-cli-net8-net10

Conversation

@aboryczko

Copy link
Copy Markdown

Fixes #429
Fixes #324
Fixes #428
Fixes #448

odata-cli targets net6.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.0 and bumps Microsoft.Build.Locator to 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 generate on a .NET 8/10-only machine without the crash.

@aboryczko

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@aboryczko aboryczko marked this pull request as ready for review May 31, 2026 14:27
@aboryczko

Copy link
Copy Markdown
Author

@gathogojr any chance on getting this merged?

@aboryczko

Copy link
Copy Markdown
Author

@habbes @marabooy any chance on getting this merged?

@xuzhg xuzhg requested review from WanjohiSammy, Copilot and gathogojr and removed request for Copilot June 22, 2026 21:17

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0</TargetFrameworks>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Targeting on .NET10 is enough?

@aboryczko aboryczko Jun 23, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@xuzhg xuzhg mentioned this pull request Jun 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.Cli and Microsoft.OData.Cli.Tests to net8.0;net10.0, and bump the CLI package version to 0.4.0.
  • Update MSBuild discovery by bumping Microsoft.Build.Locator to 1.11.2 and guarding registration with IsRegistered.
  • 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
@aboryczko

Copy link
Copy Markdown
Author

@gathogojr @WanjohiSammy need just one more "yes" 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants