Requirements: Create a new library project in .NET 8 (Sdk="Microsoft.NET.Sdk", this library is a help class, there will be many extension methods, such as web-related extensions, but you will find that it cannot be referenced, prompting that the reference cannot be found, how can you reference the methods in AspNetCore?
.NET Project SDK
SDKs available, available include:
ID | description | Repository | | Microsoft.NET.Sdk | .NET SDK | https://github.com/dotnet/sdk | | Microsoft.NET.Sdk.Web | .NETWeb SDK | https://github.com/dotnet/sdk | | Microsoft.NET.Sdk.Razor | .NETRazor SDK | https://github.com/dotnet/aspnetcore | | Microsoft.NET.Sdk.BlazorWebAssembly | The .NETBlazor WebAssemblySDK | https://github.com/dotnet/aspnetcore | | Microsoft.NET.Sdk.Worker | .NETWork Services SDK | https://github.com/dotnet/aspnetcore | | Aspire.AppHost.Sdk | .NETAspire SDK | https://github.com/dotnet/aspire | | MSTest.Sdk | MSTest SDK | https://github.com/microsoft/testfx |
Option 1
Using the shared framework, the configuration is as follows:
The shared framework isA collection of assemblies included in the runtime, so there is no need to resolve them separately through NuGet。 You can think of it as a NuGet package, though, because they are handled very similarly. The main difference is that it doesn't need to be downloaded from NuGet because it's already included in the runtime environment.
Since it is distributed with the runtime environment, this means you cannot reference a specific version of it. Instead, you always get the version included in the available version of the runtime environment. The benefit of this is that when the runtime environment is updated, its contents are automatically updated, so applications that rely on shared frameworks are also automatically updated at runtime.
Option 2
Modify the SDK directly, and configure it as follows:
Reference:
The hyperlink login is visible.
The hyperlink login is visible. |