You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When installing a dotnet global tool that targets a specific SDK (e.g. 5.0.100) from a folder that contains a global.json that pins the SDK to different version (e.g. 3.1.100), dotnet won't install the global tool even if the user has SDK 5.0.100 installed.
Repro steps
Create a global.json file that pins the SDK to any version < 5.0.100:
mkdir repro
cd repro
dotnet new globaljson --sdk-version 3.1.100
dotnet tool update dependadotnet --version 1.0.4-g
error NU1202: Package dependadotnet 1.0.4 is not compatible with netcoreapp3.1 (.NETCoreApp,Version=v3.1) / any. Package dependadotnet 1.0.4 supports: net5.0 (.NETCoreApp,Version=v5.0) / any
Tool 'dependadotnet' failed to update due to the following:
The tool package could not be restored.
Tool 'dependadotnet' 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.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
This seems to me like it's blocked until we acquire tools via NuGet API directly instead of by restoring a project behind the scenes. Because we currently restore a project, the restore operation happens in the context of the currently-chosen SDK, which is why you see this error. In an API-driven scenario, we could look at all the installed/available runtimes, compare those against the available versions of the desired global tool package (based on the version the user specified, if any), and choose the most appropriate version/arch/TFM of the global tool to install.
When installing a dotnet global tool that targets a specific SDK (e.g.
5.0.100
) from a folder that contains aglobal.json
that pins the SDK to different version (e.g.3.1.100
), dotnet won't install the global tool even if the user has SDK5.0.100
installed.Repro steps
Create a global.json file that pins the SDK to any version <
5.0.100
:You'll get an error because dependadotnet 1.0.4 only targets .NET 5:
dotnet --info
The text was updated successfully, but these errors were encountered: