Search code examples
asp.net-core.net-corecsproj

Where is PackageReference entry in .csproj file in ASP.NET Core 3?


Previously in ASP.NET Core 2.0 when you create a new web project with dotnet new web and you open .csproj file you would have PackageReference entry like this:

enter image description here

But today I started playing with ASP.NET Core 3.1, and I noticed that when you create a new project in the same manner, the .csproj file contains only this:

enter image description here

Where did the PackageReference entry go and how does ASP.NET Core knows how to build and run the project without this information?


Solution

  • The distribution mechanism of shared framework reference assemblies and build logic changed. It is no longer based on NuGet and uses FrameworkReference items.

    The Web SDK (Microsoft.NET.Sdk.Web) references this framework automatically.

    If you need to use types / APIs only available in ASP.NET Core and not via separate NuGet packages from non-Web projects (Sdk="Microsoft.NET.Sdk"), you can use:

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