问题描述
具体来说,我正在尝试运行 dotnet tool install --global Project2015To2017.Migrate2017.Tool
如此处所述 - https://github.com/hvanbakel/CsprojToVs2017#as-a-net-core-global-tool
Specifically, I am trying to run dotnet tool install --global Project2015To2017.Migrate2017.Tool
as explained here - https://github.com/hvanbakel/CsprojToVs2017#as-a-net-core-global-tool
这是我得到的:
c:Program Filesdotnetsdk2.1.4SdksMicrosoft.NET.SdkuildMicrosoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [C:UsersmkharitonovAppDataLocalTemp3sdfphfy.fq0
estore.csproj]
The tool package could not be restored.
Tool 'project2015to2017.migrate2017.tool' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
所以,我去了https://www.microsoft.com/net/download/dotnet-core/2.1 并安装了 SDK 2.1.500 的 .NET Core Installer x64.当这不起作用时,我为 Runtime 2.1.6 安装了相同的(不认为它做任何事情).无论如何,错误消息仍然存在,我不知道我应该做什么.
So, I went to https://www.microsoft.com/net/download/dotnet-core/2.1 and installed the .NET Core Installer x64 of SDK 2.1.500. When this did not work I installed the same for Runtime 2.1.6 (do not think it did anything). Anyway, the error message stays and I have no idea what am I expected to do.
编辑 1
C:xyzMyApp [master ≡]> dotnet --list-sdks
1.0.0-preview2-003131 [C:Program Filesdotnetsdk]
2.1.4 [C:Program Filesdotnetsdk]
2.1.403 [C:Program Filesdotnetsdk]
2.1.500 [C:Program Filesdotnetsdk]
编辑 2
C:xyzMyApp [master ≡]> dotnet new globaljson --sdk-version 2.1.500
The template "global.json file" was created successfully.
C:xyzMyApp [master ≡ +1 ~0 -0 !]> cat .global.json
{
"sdk": {
"version": "2.1.500"
}
}
C:xyzMyApp [master ≡ +1 ~0 -0 !]> dotnet tool install --global Project2015To2017.Migrate2017.Tool
c:Program Filesdotnetsdk2.1.4SdksMicrosoft.NET.SdkuildMicrosoft.NET.TargetFrameworkInference.targets(135,5): error : The current .NET SDK does not support targeting .NET Core 2.1. Either target .NET Core 2.0 or lower, or use a version of the .NET SDK that supports .NET Core 2.1. [C:UsersmkharitonovAppDataLocalTemplrfiazvp.bxe
estore.csproj]
The tool package could not be restored.
Tool 'project2015to2017.migrate2017.tool' failed to install. This failure may have been caused by:
* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.
C:xyzMyApp [master ≡ +1 ~0 -0 !]>
编辑 3
C:UsersmkharitonovAppDataLocalTemp> dotnet --list-sdks
1.0.0-preview2-003131 [C:Program Filesdotnetsdk]
2.1.4 [C:Program Filesdotnetsdk]
2.1.403 [C:Program Filesdotnetsdk]
2.1.500 [C:Program Filesdotnetsdk]
C:UsersmkharitonovAppDataLocalTemp> Test-Path global.json
False
C:UsersmkharitonovAppDataLocalTemp> cd ..
C:UsersmkharitonovAppDataLocal> Test-Path global.json
False
C:UsersmkharitonovAppDataLocal> cd ..
C:UsersmkharitonovAppData> Test-Path global.json
False
C:UsersmkharitonovAppData> cd ..
C:Usersmkharitonov> Test-Path global.json
False
C:Usersmkharitonov> cd ..
C:Users> Test-Path global.json
False
C:Users> cd ..
C:> Test-Path global.json
False
C:>
推荐答案
您可以运行具有诊断详细级别的 dotnet 工具安装.例如:
You can run dotnet tool install with diagnostic verbosity level.For example:
dotnet tool install --global Project2015To2017.Migrate2017.Tool -v diag
我遇到了一些问题,就我而言,我遇到了错误:
I had some problem and in my case I had error:
The SDK 'Microsoft.NET.Sdk' specified could not be found
为了解决这个问题,我更改了环境变量 MSBuildSDKsPath(来自 https://github.com/Microsoft/msbuild/issues/2532)
To solve this problem I changed environment variable MSBuildSDKsPath (advice from https://github.com/Microsoft/msbuild/issues/2532)
这篇关于为什么我无法运行 dotnet tool install --global bla-bla-bla?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!