I can't understand what I'm doing wrong. I'm trying to install ElectronNET.CLI package (https://www.nuget.org/packages/ElectronNET.CLI) through windows cmd:
dotnet tool install ElectronNET.CLI --version 11.5.1
but I've got error message:
error NU1202: Package ElectronNET.CLI 11.5.1 is not compatible with net50
(.NETFramework,Version=v5.0) / any.
Package ElectronNET.CLI 11.5.1 supports: net5.0 (.NETCoreApp,Version=v5.0) / any
The tool package could not be restored.
Tool 'electronnet.cli' 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 tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet con
nection problem.
* You mistyped the name of the tool.
My .csproj file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ElectronNET.API" Version="11.5.1" />
</ItemGroup>
</Project>
Also I've created global.json file to override my sdk's global version. Because the package I'm trying to install targets net5, and current project version is net5, but my global sdk version is .net6. global.json:
{
"sdk": {
"version": "5.0.103"
}
}
What are the reasons describing that nuget package manager thinks I'm using .net50 (.NET Framework) instead of .net5.0? How and where can I change this version?
For instance, when I created another c# project with .netcore 3.1 version and ElectronNet API and CLI of 9.31.2 versions (that targets netcore 3.1), everything was installed and worked fine.
UPD: I updated nuget.exe using nuget.exe update -self, but the new version works the same way with the same error.
UPD2: Tried to instal cli tool through visual studio. The message is much more confusing:

UPD3: I removed net6 preview sdk from my computer, updated visual studio to 16.8.6 (and then did a "repair" of IDE through vs installer). I cleared nuget cache. Seems that cli tool that I tried to install now is installed, but now cmd dotnet build failed with the same message (package ... is not compatible) but now it says that already installed nuget package ElectronNET.API 11.5.1 is not compatible with net50! At the same time Visual Studio IDE successfully builds and runs this project (through IIS Express)! Only when I'm trying to use dotnet build then errors are miraculously appearing in the IDE:

Found similar problem https://developercommunity.visualstudio.com/t/error-msb4018-the-resolvepackagedependencies-task/1266042, but there are no solutions.
Then I created a new clean blazor project based on .net5. Visual Studio successfully builds it, but dotnet build no. It says:
C:\Program Files\dotnet\sdk\5.0.103\Microsoft.Common.CurrentVersion.targets(1180,5):
error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found.
To resolve this, install the Developer Pack (SDK/Targeting Pack) for this
framework version or retarget your application. You can download .NET Framework
Developer Packs at https://aka.ms/msbuild/developerpacks
What a nice surprise. According to this post The reference assemblies for framework .NETCore, Version=v5.0 were not found I've noticed that I have no .net5 folder neither in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework nor in C:\Program Files\Reference Assemblies\Microsoft\Framework.
I reinstalled visual studio along with net5. Sdk appeared in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v5.0, but build error is the same. Obviously dotnet treats my <TargetFramework>net5.0</TargetFramework> as net50
(.NETFramework,Version=v5.0) and I don't know why.


