【发布时间】:2018-09-26 22:46:42
【问题描述】:
我正在构建一个 dotnet 核心工具,但在全局安装它时遇到问题。我可以复制我遇到的问题,但不知道如何解决。以下是我的步骤
- dotnet 新控制台 -o testconsole
- 修改 testconsole.csproj 以包含
<PackAsTool>和<PackageOutputPath>
- dotnet restore testconsole.csproj
- dotnet 构建 testconsole.csproj
- dotnet pack testconsole.csproj
- dotnet tool install -g -v d --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/ 的建议
【问题讨论】:
标签: c# .net-core nuget-package