NuGet Warning NU1212

Scenario 1

Invalid project-package combination for Contoso.Library 1.0.0. DotnetToolReference project style can only contain references of the DotnetTool type

Issue

DotnetToolReference project style can only reference .NET tools with the DotnetTool package type. Either the project style is not DotnetToolReference or a referenced package is not of DotnetTool type.

Solution

Projects of this style are normally not ordinary projects and the dotnet tool commands should be used to manage your dotnet tools. Contoso.Library is not a DotnetTool package. Use a different package that's of the DotnetTool type.

Scenario 2

Invalid project-package combination for Contoso.Library 1.0.0. DotnetToolReference project style can only contain references of the DotnetTool type

Issue

DotnetToolReference project style can only reference .NET tools with the DotnetTool package type. Either the project style is not DotnetToolReference or a referenced package is not of DotnetTool type.

Solution

Projects of this style are normally not ordinary projects and the dotnet tool commands should be used to manage your dotnet tools.

The project in question is not a DotnetToolReference project, but the package is of the DotnetTool type. Change the RestoreProjectStyle to DotnetToolReference.