NuGet Error NU1012

Scenario 1

Platform version is not present for one or more target frameworks, even though they have specified a platform: net6.0-android.

Issue

You have specified a target framework with a platform in your project file but the platform version is not available.

Solution

  • If you are specifying TargetPlatformVersion manually, please ensure a version is included.
  • If you are using the .NET SDK, and the TargetFramework(s) property contains net6.0-android, the .NET SDK is supposed to automatically add a platform version. If you are experiencing this, file an issue at dotnet/sdk.

Scenario 2

Some dependency group TFMs are missing a platform version: net6.0-android

Issue

When creating a package for a framework with a platform such as android, you need to specify the correct platform version.

Solution

Specify the platform version in your nuspec.

Example: <group targetFramework="net6.0-android32.0">

If you are using the pack targets, the platform version will be automatically inferred.

Scenario 3

Some included files are included under TFMs which are missing a platform version: lib/net6.0-android/Foo.dll, build/net9.0-windows/Foo.props

Issue

Some of the files being packaged according to the NuGet packaging conventions have framework parts that are missing a platform version.

Solution

Specify the platform version in your nuspec or in the pack extensibility targets in your project file.

Example: lib/net6.0-android32.0/Foo.dll, build/net9.0-windows10.0.19041/Foo.props