It was not possible to find any installed .NET SDKs - c#

I have installed multiple versions of .NET Sdk.Now the Omnisharp suggestions is not working fine.
output shows these
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /BO-V2/Techne-Travel/travel-techne-bo-for-ota/src/Application/Application.csproj
A compatible installed .NET SDK for global.json version [6.0.101] from [/BO-V2/Techne-Travel/travel-techne-bo-for-ota/global.json] was not found.
Install the [6.0.101] .NET SDK or update [/BO-V2/Techne-Travel/travel-techne-bo-for-ota/global.json] with an installed .NET SDK:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
A compatible installed .NET SDK for global.json version [6.0.101] from [/BO-V2/Techne-Travel/travel-techne-bo-for-ota/global.json] was not found.
Install the [6.0.101] .NET SDK or update [/BO-V2/Techne-Travel/travel-techne-bo-for-ota/global.json] with an installed .NET SDK:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download
[fail]: OmniSharp.MSBuild.ProjectLoader
Unable to locate the .NET SDK. Check that it is installed and that the version specified in global.json (if any) matches the installed version.
[fail]: OmniSharp.MSBuild.ProjectLoader
The SDK 'Microsoft.NET.SDK.WorkloadAutoImportPropsLocator' specified could not be found.
[fail]: OmniSharp.MSBuild.ProjectManager
But dotnet --info shows this output
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: ubuntu
OS Version: 20.04
OS Platform: Linux
RID: ubuntu.20.04-x64
Base Path: /usr/share/dotnet/sdk/6.0.101/
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
3.1.415 [/usr/share/dotnet/sdk]
5.0.100 [/usr/share/dotnet/sdk]
5.0.209 [/usr/share/dotnet/sdk]
5.0.403 [/usr/share/dotnet/sdk]
6.0.100 [/usr/share/dotnet/sdk]
6.0.101 [/usr/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.12 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.21 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
which dotnet command
/usr/bin/dotnet
I have searched in google and find this
https://www.py4u.net/discuss/1941159.
I did below as they said.
But Still I face the same issue.
Why this issue? How can I solve this
setting.json
{
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll": false
},
"omnisharp.path": "latest",
}
omnisharp.json
{
"MsBuild": {
"UseLegacySdkResolver": true
}
}
global.json
{
"sdk": {
"version": "6.0.101",
"rollForward": "latestMinor"
}
}
What should I do to make omnisharp works fine?
I could not continue the work without Omnisharp Suggestion. It is hard to code. Please help me.

See the documentation here https://github.com/OmniSharp/omnisharp-vscode
Using .NET 6 builds of OmniSharp Starting with C# extension version
1.24.0, there is now an option to use build of OmniSharp that runs on the .NET 6 SDK. This build requires that the .NET 6 SDK be installed
and does not use Visual Studio MSBuild tools or Mono. It only supports
newer SDK-style projects that are buildable with dotnet build. Unity
projects and other Full Framework projects are not supported.
To use the .NET 6 build, set omnisharp.useModernNet to true in your VS
Code settings and restart OmniSharp.

Related

/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Root element is missing. [~/projects/test-proj/test-proj.csproj]

So now dotnet restore started throwing this error:
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Root element is missing. [/home/francardoso/projects/test-proj/test-proj.csproj]
It happens for existing projects, but also if I try to create a fresh new webapi.
Already tried to reinstall dotnet.
Why is this happening?
$ dotnet new webapi -n test-proj
The template "ASP.NET Core Web API" was created successfully.
Processing post-creation actions...
Running 'dotnet restore' on test-proj/test-proj.csproj...
/usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Root element is missing. [/home/francardoso/projects/test-proj/test-proj.csproj]
Restore failed.
Post action failed.
Description: Restore NuGet packages required by this project.
Manual instructions: Run 'dotnet restore'
dotnet restore /usr/share/dotnet/sdk/2.2.402/NuGet.targets(123,5): error : Root element is missing. [/home/francardoso/projects/test-proj/test-proj.csproj]
$ dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.402
Commit: c7f2f96116
Runtime Environment:
OS Name: ubuntu
OS Version: 18.04
OS Platform: Linux
RID: ubuntu.18.04-x64
Base Path: /usr/share/dotnet/sdk/2.2.402/
Host (useful for support):
Version: 2.2.8
Commit: b9aa1abc51
.NET Core SDKs installed:
2.2.402 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Same on dotnet sdk 6.0.405. Clearing nuget cache worked for me:
dotnet nuget locals all --clear

dotnet ef migrations issue in Ubuntu 19.10. Dotnet sdk 3.1.1

I installed dotnet ef tool in order to generate migrations for a dotnet core project am working on using the command. dotnet tool install -g dotnet-ef. The installation was successfull. In order to us dotnet ef i have installed the nuget packages below
Microsoft.EntityFrameworkCore.SqlServer
Microsoft.EntityFrameworkCore
Microsoft.AspNetCore.Identity.EntityFrameworkCore
Microsoft.EntityFrameworkCore.Tools
When trying to generate migrations using the command dotnet ef migrations add IdentityandCategory i get the output below.
It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '3.1.1' was not found.
- The following frameworks were found:
2.1.14 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
2.2.8 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
3.1.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=3.1.1&arch=x64&rid=ubuntu.19.10-x64
I reinstall dotnet 3.1.1 but this trouble continues. dotnet info seem to detect the version
when i run donet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.100
Commit: cd82f021f4
Runtime Environment:
OS Name: ubuntu
OS Version: 19.10
OS Platform: Linux
RID: ubuntu.19.10-x64
Base Path: /usr/share/dotnet/sdk/3.1.100/
Host (useful for support):
Version: 3.1.0
Commit: 157910edee
.NET Core SDKs installed:
2.1.802 [/usr/share/dotnet/sdk]
2.2.402 [/usr/share/dotnet/sdk]
3.1.100 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
How can i solve this issues? Thank in advance for your help
I ran into this issue today on Azure Pipelines. The easiest way to fix it is to explicitly install dotnet-ef by specifying the exact version you need.
dotnet tool install --global dotnet-ef --version 3.1.0
I believe that the .NET Core Runtime version and the dotnet-ef version have to be in sync. Since there was a security patch released recently that bumped .NET Core Runtime up to 3.1.1, there is a mismatch and that is why it is complaining.
That said, it is probably wise to just update everything to 3.1.1 when time permits.

Cannot install dotnet-ef tool on Windows 10

I'm trying to install the dotnet-ef tool via the dotnet-cli.
The command that I enter: dotnet tool install --global dotnet-ef
I gives me the following error:
The tool package could not be restored.
Tool 'dotnet-ef' 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.
I'm using dotnet 3.0, I believe I didn't have this problem on MacOS, I'm now trying to execute the same command on my Windows 10 machine and it gives me that error.
Some info using dotnet --info command:
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100\
Host (useful for support):
Version: 3.0.0
Commit: 7d57652f33
.NET Core SDKs installed:
3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I got it working by adding the --version flag and specifying the version to 3.0.0.
The command that I used:
dotnet tool install --global dotnet-ef --version 3.0.0
dotnet tool install -g dotnet-ef --ignore-failed-sources worked for me. Thanks to Anas-Alhariri
Source
I had the same issue on Mac OS recently.
It was related to the fact that we use our own NuGet feed (packageSources section).
So, I fixed that by removing the custom NuGet feed from NuGet.config file for a while.
If everything else failed then you should check in your Visual Studio the next route: Tools > NuGet Package Manager > Package Manager Settings > Nuget Package Manager > Package Sources.
There you should have nuget.org, if not and you only have Microsoft Visual Studio Offline Packages, well that is the problem. Next you need to add the package resource nuget.org like this:
Once you click Ok you can go back to your terminal and install dotnet-ef with no problem.
I got this error message, but when I closely inspected all the errors I also had:
Response status code does not indicate success: 407 (Proxy Authorization Required).
Turning off the proxy while running the command fixed the issue.
I got this error when I tried to run the command from the Package Manager Console instead of a Powershell command window.
For some of reasons you can try to delete directory C:\Program Files\dotnet\sdk-manifests it will make you can download it.
.net 6
ref : https://github.com/dotnet/sdk/issues/23435

Dotnet test ignoring filter when on Linux

I'm using xunit, with trait attributes set on some of my tests. When running dotnet test I'm trying to filter by these traits. I have it working fine locally on my Windows machine but when I run the same command on my CI container then it doesn't filter my tests.
The command is:
dotnet test --filter Category=Integration
I'm using CircleCI with the container mcr.microsoft.com/dotnet/core/sdk:2.2
When I SSH to the box and try running the command, it just runs all of the tests.
dotnet --info from the container:
.NET Core SDK (reflecting any global.json):
Version: 2.1.700
Commit: c2ef055a0f
Runtime Environment:
OS Name: debian
OS Version: 9
OS Platform: Linux
RID: debian.9-x64
Base Path: /usr/share/dotnet/sdk/2.1.700/
Host (useful for support):
Version: 2.1.11
Commit: d6a5616240
.NET Core SDKs installed:
2.1.700 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I've managed to resolve my issue just about. It appears it's a bug with the 16.1.0 SDK version (which dictates the version of vstest). As the issue was just on CI for me, I pinned the container I was using to
mcr.microsoft.com/dotnet/core/sdk#sha256:d0a71e1312be2618f320a7b7cc6d7423af3810542b3ffd35438108800ecfb958
which contains the 16.0.1 SDK. It's not the perfect fix but resolves my immediate issue.

Using Jenkins SonarQube MSBuild plugin with dotnet core on linux

i am struggling to both understand and get the Jenkins SonarQube MSBuild to analyse a dotnet core c# project and hoped someone could help out with it. I am able to run the scan using the following commands in an "Execute Shell" build step:
dotnet sonarscanner begin /k:"xxx" /n:"xxx" /v:"xxx"
dotnet build xx.sln --configuration Release
dotnet sonarscanner end
my current setup is:
Jenkins Server running on Amazon linux, on which i have installed jenkins (version 2.150.2) dotnet core and the sonarqube msbuild plugin
[jenkins#jenkins_qa sonar]# dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 2.2.104
Commit: 73f036d4ac
Runtime Environment:
OS Name: amzn
OS Version: 2
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/2.2.104/
Host (useful for support):
Version: 2.2.2
Commit: a4fd7b2c84
.NET Core SDKs installed:
2.1.4 [/usr/share/dotnet/sdk]
2.2.104 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
sonarqube server is installed on an Amazon Windows Instance.
I would like to use the plugin to run the analysis as this will include the report on the jenkins ui.
Thanks in advance

Categories