NETSDK1071: Explicitly versioned PackageReference to a metapackage that would be included with the framework.
This article applies to: ✔️ .NET 5.0.100 SDK and later versions
When the .NET SDK issues warning NETSDK1071, it suggests there may be a version conflict in the future between the version of a metapackage specified in a PackageReference and the version of that metapackage as implicitly referenced via a TargetFramework property:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
Since the TargetFramework
automatically brings in a version of the metapackage, the versions will conflict should they ever differ.
To resolve this:
When you target .NET Core or .NET Standard, consider avoiding explicit references to
Microsoft.NETCore.App
orNETStandard.Library
in your project file.If you need a specific version of the runtime when targeting .NET Core, use the
<RuntimeFrameworkVersion>
property instead of referencing the metapackage directly. As an example, this could happen if you're using self-contained deployments and need a specific patch of the 1.0.0 LTS runtime.If you need a specific version of
NetStandard.Library
when targeting .NET Standard, you can use the<NetStandardImplicitPackageVersion>
property and set it to the version you need.Don't explicitly add or update references to either
Microsoft.NETCore.App
orNETSTandard.Library
in .NET Framework projects. NuGet automatically installs any version ofNETStandard.Library
you need when using a .NET Standard-based NuGet package.Do not specify a version for
Microsoft.AspNetCore.App
orMicrosoft.AspNetCore.All
when using .NET Core 2.1+, as the .NET SDK automatically selects the appropriate version. (Note: This only works when targeting .NET Core 2.1 if the project also usesMicrosoft.NET.Sdk.Web
. This problem was resolved in the .NET Core 2.2 SDK.)If you want the warning to go away, you can also disable it:
<PackageReference Include="Microsoft.NetCore.App" Version="2.2.8" > <AllowExplicitVersion>true</AllowExplicitVersion> </PackageReference>