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>
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(); }
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!