Home > Backend Development > C++ > How to Resolve Missing NuGet Package References in ASP.NET Core 6 App Parts Projects?

How to Resolve Missing NuGet Package References in ASP.NET Core 6 App Parts Projects?

DDD
Release: 2024-12-30 01:28:10
Original
326 people have browsed it

How to Resolve Missing NuGet Package References in ASP.NET Core 6 App Parts Projects?

Missing NuGet Package References for ASP.NET Core 6 App Parts Project

When creating an ASP.NET Core 6 application with separate assemblies providing additional areas, adding an extension method for IMvcBuilder to conveniently register app parts may encounter build errors. This is because the parts library lacks a Main method definition, requiring a revert to Microsoft.NET.Sdk.

In this case, the missing NuGet package references can be resolved by adding:

<ItemGroup>
  <FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Copy after login

to the library project's .csproj file.

Alternatively, you can define an internal Program class with a Main method to satisfy the build requirement for the Microsoft.NET.Sdk.Web SDK. Here's an example:

internal static class Program
{
    public static void Main() => throw new NotImplementedException();
}
Copy after login

The above is the detailed content of How to Resolve Missing NuGet Package References in ASP.NET Core 6 App Parts Projects?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template