小编Aus*_*Dev的帖子

如何修复 NU1212 以安装 dotnet 工具

我正在构建一个 dotnet 核心工具,但在全局安装时遇到问题。我可以复制我遇到的问题,但不知道如何解决它。下面是我的步骤

  1. dotnet 新控制台 -o testconsole
  2. 修改 testconsole.csproj 以包含<PackAsTool><PackageOutputPath>

testconsole.csproj

  1. dotnet 恢复 testconsole.csproj
  2. dotnet 构建 testconsole.csproj
  3. dotnet 包 testconsole.csproj
  4. dotnet 工具安装 -g -vd --add-source ./nupkg testconsole

安装时我收到以下错误

error NU1212: Invalid project-package combination for TestConsole 1.0.9. DotnetToolReference project style can only contain references of the DotnetTool type

安装错误

这是 nupkg 中 testconsole.nuspec 的副本,其中包含 <packageType name="DotnetTool" />来自https://natemcmaster.com/blog/2018/05/12/dotnet-global-tools/的建议

testconsole.nupsec

c# nuget-package .net-core

4
推荐指数
2
解决办法
3789
查看次数

标签 统计

.net-core ×1

c# ×1

nuget-package ×1