Unexpected pickup of old runtime version for tool package
See original GitHub issueI have installed these runtime versions: 2.1, 2.2, 3.1, 5.0
When I install this package into a project that targets netcoreapp3.1 and try to restore packages with dotnet restore
, I get this error output:
C:\Source\MyApp\MyApp.csproj : error NU1202: Das Paket Unclassified.DotnetSshDeploy 0.4.0 ist nicht mit netcoreapp2.2 (.NETCoreApp,Version=v2.2) kompatibel. Paket Unclassified.DotnetSshDeploy 0.4.0 unterstützt Folgendes: [C:\Source\MyApp\MyApp.sln]
C:\Source\MyApp\MyApp.csproj : error NU1202: - net5.0 (.NETCoreApp,Version=v5.0) [C:\Source\MyApp\MyApp.sln]
C:\Source\MyApp\MyApp.csproj : error NU1202: - netcoreapp3.1 (.NETCoreApp,Version=v3.1) [C:\Source\MyApp\MyApp.sln]
This also leads to more errors of the same kind later so it breaks my build.
The DotnetSshDeploy package has been upgraded from 0.3.1 to 0.4.0, that’s the only change. And that tool now targets both netcoreapp3.1 and net5.0 instead of netcoreapp2.0. That’s probably the major change in that package. But nobody uses or references .NET Core 2.2 (anymore)! I’ve deleted all build files and the .vs directory, then searched the contents of all files in the solution for “netcoreapp2.2” – no matches at all. Yet this error occurs. Something seems to stick with the old runtime version even though it’s not configured anymore. Should I uninstall that version from my computer? (Some other older projects might still need it.)
What makes the dotnet CLI think that an old version should be used what nobody told it so?
dotnet --info
:
.NET SDK (gemäß "global.json"):
Version: 5.0.103
Commit: 72dec52dbd
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.103\
Host (useful for support):
Version: 5.0.3
Commit: c636bbdc8a
.NET SDKs installed:
5.0.103 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Here’s a very simple sample app that I put together in a few minutes. It reproduces the trouble very quickly. The CliTool project is the one that generates the tool package. Its build output is included in the archive but you can rebuild it. Put the nupkg file in a directory that you have configured as NuGet package source on your local machine. (You need that anyway when working with your own packages.) The CliToolConsumer project then uses that project. It won’t build as you’ll see.
Seems the dotnet CLI isn’t production ready and needs to be fixed urgently! Strange that nobody noticed that yet. Am I the first user of it, again?
CliTool.zip
Yes, local tools are the replacement for
DotNetCliToolReference
. Here is the documentation: https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools#install-a-local-tool