【发布时间】:2020-06-17 20:36:00
【问题描述】:
我已经按照 create a dotnet tool 和 install it locally 的教程进行操作。满意后,我尝试将命令的名称从botsay 更改为something-else。不幸的是,它总是使用命令名称botsay 安装。即使我运行dotnet tool uninstall,删除项目并重新开始,它仍然使用教程中的名称。我可以更改它的唯一方法是将项目名称更改为其他名称。为什么它使用旧的命令名称,我该如何更改它?
目录结构为:
sources
--My.Project.Name
----nupkg
------My.Project.Name.1.0.0.nupkg
--.config
----dotnet-tools.json
我的 csproj 是:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackAsTool>true</PackAsTool>
<ToolCommandName>something-else</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
</PropertyGroup>
</Project>
而 dotnet-tools.json 是:
{
"version": 1,
"isRoot": true,
"tools": {
"my-project-name": {
"version": "1.0.0",
"commands": [
"botsay" <--- I want this to be "something-else"
]
}
}
}
【问题讨论】:
标签: c# .net-core csproj dotnet-tool