Skip to content

When targetting .Net8, it is necessary to use "8.x" versions of nugets, NOT "latest", which is now "9.x". #34207

@ToolmakerSteve

Description

@ToolmakerSteve

Description

There are multiple places in .Net docs where this is relevant, now that .Net 9 is released.

I have found that (some? all?) "9.x" Nugets do NOT support .Net 8.

For example, Build a Windows Presentation Foundation (WPF) Blazor app:

Use NuGet Package Manager to install the Microsoft.AspNetCore.Components.WebView.Wpf NuGet package:

By default, "Latest stable" is selected for installation. Currently, this is 9.0.10.

If install that in a project that targets .Net 8, there will be a variety of build errors.
Most of the errors won't mention namespace Microsoft.AspNetCore.Components.WebView.Wpf.
Rather, they mention OTHER namespaces, from nugets that are dependencies of that one.
For example, Microsoft.AspNetCore.Components.Web and Microsoft.Extensions.DependencyInjection.

However, those dependencies do not get included. (Nor should they, given the incompatibility between 9.x nugets and .Net 8.)

Because of the non-obviousness of the error messages, it is important to alert developers to be careful that they select nuget versions starting with 8., when targetting .Net 8.

Page URL

https://learn.microsoft.com/en-us/aspnet/core/blazor/hybrid/tutorials/wpf?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/blazor/hybrid/tutorials/wpf.md

Document ID

94872f14-0dce-0cf3-0d25-88f23ca8d8ef

Article author

@guardrex

Related Issues

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions