Почему я не могу запустить dotnet tool install --global bla-bla-bla? - PullRequest
0 голосов
/ 19 ноября 2018

В частности, я пытаюсь запустить dotnet tool install --global Project2015To2017.Migrate2017.Tool, как объяснено здесь - https://github.com/hvanbakel/CsprojToVs2017#as-a-net-core-global-tool

Вот что я получаю:

c:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.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:\Users\mkharitonov\AppData\Local\Temp\3sdfphfy.fq0\restore.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 и установил .NET Core Installer x64 из SDK 2.1.500.Когда это не сработало, я установил то же самое для Runtime 2.1.6 (не думаю, что он что-то сделал).В любом случае, сообщение об ошибке остается, и я понятия не имею, что я должен делать.

РЕДАКТИРОВАТЬ 1

C:\xyz\MyApp [master ≡]> dotnet --list-sdks
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]

РЕДАКТИРОВАТЬ 2

C:\xyz\MyApp [master ≡]> dotnet new globaljson --sdk-version 2.1.500
The template "global.json file" was created successfully.
C:\xyz\MyApp [master ≡ +1 ~0 -0 !]> cat .\global.json
{
  "sdk": {
    "version": "2.1.500"
  }
}
C:\xyz\MyApp [master ≡ +1 ~0 -0 !]> dotnet tool install --global Project2015To2017.Migrate2017.Tool
c:\Program Files\dotnet\sdk\2.1.4\Sdks\Microsoft.NET.Sdk\build\Microsoft.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:\Users\mkharitonov\AppData\Local\Temp\lrfiazvp.bxe\restore.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:\xyz\MyApp [master ≡ +1 ~0 -0 !]>

РЕДАКТИРОВАТЬ 3

C:\Users\mkharitonov\AppData\Local\Temp> dotnet --list-sdks
1.0.0-preview2-003131 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.500 [C:\Program Files\dotnet\sdk]
C:\Users\mkharitonov\AppData\Local\Temp> Test-Path global.json
False
C:\Users\mkharitonov\AppData\Local\Temp> cd ..
C:\Users\mkharitonov\AppData\Local> Test-Path global.json
False
C:\Users\mkharitonov\AppData\Local> cd ..
C:\Users\mkharitonov\AppData> Test-Path global.json
False
C:\Users\mkharitonov\AppData> cd ..
C:\Users\mkharitonov> Test-Path global.json
False
C:\Users\mkharitonov> cd ..
C:\Users> Test-Path global.json
False
C:\Users> cd ..
C:\> Test-Path global.json
False
C:\>

1 Ответ

0 голосов
/ 17 мая 2019

Вы можете запустить dotnet tool install с уровнем диагностической детализации.Например:

dotnet tool install --global Project2015To2017.Migrate2017.Tool -v diag

У меня была некоторая проблема, и в моем случае у меня была ошибка:

The SDK 'Microsoft.NET.Sdk' specified could not be found

Чтобы решить эту проблему, я изменил переменную окружения MSBuildSDKsPath (советот https://github.com/Microsoft/msbuild/issues/2532)

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...