NuGet 警告 NU1212

方案 1

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

问题

DotnetToolReference 项目样式只能引用具有 DotnetTool 包类型的 .NET 工具。 项目样式不是 DotnetToolReference,或者引用的包不是 DotnetTool 类型。

解决方案

此样式的项目通常不是普通项目,且应使用 dotnet 工具命令来管理 dotnet 工具。 Contoso.Library 不是 DotnetTool 包。 使用 DotnetTool 类型的其他包。

方案 2

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

问题

DotnetToolReference 项目样式只能引用具有 DotnetTool 包类型的 .NET 工具。 项目样式不是 DotnetToolReference,或者引用的包不是 DotnetTool 类型。

解决方案

此样式的项目通常不是普通项目,且应使用 dotnet 工具命令来管理 dotnet 工具。

有问题的项目不是 DotnetToolReference 项目,但包是 DotnetTool 类型。 将 RestoreProjectStyle 更改为 DotnetToolReference。