vscode-csharp
vscode-csharp copied to clipboard
.Net.sdk.web not found
Environment data
dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.2.202
Commit: 8a7ff6789d
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.202\
Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6
.NET Core SDKs installed:
2.2.202 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
PS C:\Dotnet Core\NgWebApi>
VS Code version:1.33.0 C# Extension version:1.18.0
Steps to reproduce
Build or run from VS Code
Expected behavior
no errors
Actual behavior
Starting OmniSharp server at 4/5/2019, 3:37:16 PM
Target: c:\Dotnet Core\NgWebApi
OmniSharp server started.
Path: C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\OmniSharp.exe
PID: 13684
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 15.0 - "C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin\MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 15.0 - "C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin"
CscToolExe = csc.exe
CscToolPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin\Roslyn
MSBuildExtensionsPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild
MSBuildToolsPath = C:\Users\Acer\.vscode\extensions\ms-vscode.csharp-1.18.0\.omnisharp\1.32.11\msbuild\15.0\Bin
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Dotnet Core\NgWebApi'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\Dotnet Core\NgWebApi'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Dotnet Core\NgWebApi\NgWebApi.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Dotnet Core\NgWebApi'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Dotnet Core\NgWebApi\NgWebApi.csproj
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Dotnet Core\NgWebApi' on host 17188.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'c:\Dotnet Core\NgWebApi\NgWebApi.csproj'.
c:\Dotnet Core\NgWebApi\NgWebApi.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk.Web' specified could not be found. c:\Dotnet Core\NgWebApi\NgWebApi.csproj
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(String directoryOfImportingFile, ProjectImportElement importElement, List`1& projects, Boolean throwOnFileNotExistsError)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement)
at Microsoft.Build.Evaluation.Evaluator`4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator`4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext)
at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath)
at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath)
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectLoader loader)
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader)
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: c:\Dotnet Core\NgWebApi\NgWebApi.csproj
I am also seeing this issue.
I am also seeing this issue.
Did you find any solution? if yes please post on here. VS code not showing intellisense /suggestion. I think this was the reason for it? do you have that problem too?
I'm also getting this. It seems to be related to .NET Core being updated to 2.2.202.
.NET Core SDK (reflecting any global.json):
Version: 2.2.202
Commit: 8a7ff6789d
Runtime Environment:
OS Name: ubuntu
OS Version: 18.10
OS Platform: Linux
RID: ubuntu.18.10-x64
Base Path: /usr/share/dotnet/sdk/2.2.202/
Host (useful for support):
Version: 2.2.3
Commit: 6b8ad509b6
.NET Core SDKs installed:
2.2.202 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
This looks like it might be a duplicate of #2965.
I'm also getting this. It seems to be related to .NET Core being updated to 2.2.202.
ya, I got the point, the reason was the latest update (2.2.202.) So I downgrade .Net core to 2.1.202 and now problem solved
I'm also getting this. It seems to be related to .NET Core being updated to 2.2.202.
ya, I got the point, the reason was the latest update (2.2.202.) So I downgrade .Net core to 2.1.202 and now problem solved
I also got this problem, I try to downgrade the .Net core to 2.1.602 and have uninstalled the visual studio code many times,but the omniSharp cache always in there ,so everytime I reinstall the visual studio code,the omniSharp not reinstall,So the problem still in there
.NET Core SDK(reflecting any global.json):
Version: 2.1.602
Commit: 04475eb7cf
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.602\
Host (useful for support):
Version: 2.1.9
Commit: dcedc87d22
.NET Core SDKs installed:
2.1.602 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I'm also getting this. It seems to be related to .NET Core being updated to 2.2.202.
ya, I got the point, the reason was the latest update (2.2.202.) So I downgrade .Net core to 2.1.202 and now problem solved
I also got this problem, I try to downgrade the .Net core to 2.1.602 and have uninstalled the visual studio code many times,but the omniSharp cache always in there ,so everytime I reinstall the visual studio code,the omniSharp not reinstall,So the problem still in there
.NET Core SDK(reflecting any global.json): Version: 2.1.602 Commit: 04475eb7cf Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.602\ Host (useful for support): Version: 2.1.9 Commit: dcedc87d22 .NET Core SDKs installed: 2.1.602 [C:\Program Files\dotnet\sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
well,I figured out where the omnisharp cache is,So I reinstalled the fk little software,finally I found the reason is the slow speed of downloading the omnisharp ,haha,anyway thank u everyone

As a quick workaround, you can also set the MSBuildSDKsPath environment variable and point to Sdks location.
On Linux (Ubuntu 18.04 in my case) I added following to my .bashrc
export MSBuildSDKsPath ="/usr/share/dotnet/sdk/2.2.202/Sdks"
On Windows Edit System Environment Variables and add a system variable MSBuildSDKsPath and set to C:\Program Files\dotnet\sdk\2.2.202\Sdks
As a quick workaround, you can also set the MSBuildSDKsPath environment variable and point to Sdks location.
On Linux (Ubuntu 18.04 in my case) I added following to my .bashrc
export MSBuildSDKsPath ="/usr/share/dotnet/sdk/2.2.202/Sdks"
On Windows Edit System Environment Variables and add a system variable MSBuildSDKsPath and set to C:\Program Files\dotnet\sdk\2.2.202\Sdks
yeah,thank u ,my system is windows10 , I choosed the default install location,I checked the selection in process of install which reminded me to inject the path,my problem have been solved,thank u again :)
I'm also having this problem on Ubuntu 18.04 LTS. It just recently started.
I also have this problem on Ubuntu 18.04 LTS, and this worked for me:
$ export MSBuildSDKsPath="/usr/share/dotnet/sdk/2.1.603/Sdks/"
$ code .
Hi all, we recently changed the version of mono that ships with omnisharp to hopefully improve this. Can you give it a try by setting "omnisharp.path": "1.32.16" in your VS Code options?
@rchande I see the same problem also with "omnisharp.path": "1.32.16".
I tried also with "omnisharp.path": "latest". Nothing different.
I have the same problem
omnisharp.json { "MsBuild": { "UseLegacySdkResolver": true } }
This issue resurfaced for me.. The above mentioned fixes didn't fix it this time around for some reason. I'm using the Snap on Solus.. I had already set an alias with alias dotnet="dotnet-sdk.dotnet", but I guess that wasn't good enough.
Instead, I used sudo snap alias dotnet-sdk.dotnet dotnet and that resolved the issue for me.
:heavy_check_mark: Using the following command solved the problem for me on arch-linux:
MSBuildSDKsPath=/opt/dotnet/sdk/$(dotnet --version)/Sdks code my-dotnetcore-project
if I execute the code my-dotnetcore-project without setting MSBuildSDKsPath I am able to reproduce the issue.
exporting environment variable shall also work.
Output of dotnet --info :
.NET Core SDK (reflecting any global.json):
Version: 2.2.108
Commit: 33ed5b90ce
Runtime Environment:
OS Name: arch
OS Version:
OS Platform: Linux
RID: arch-x64
Base Path: /opt/dotnet/sdk/2.2.108/
Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51
.NET Core SDKs installed:
2.2.108 [/opt/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.NETCore.App 2.2.6 [/opt/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
please let me know if you need some more information for the bugfix. :+1:
heavy_check_mark Using the following command solved the problem for me on arch-linux:
MSBuildSDKsPath=/opt/dotnet/sdk/$(dotnet --version)/Sdks code my-dotnetcore-projectif I execute the
code my-dotnetcore-projectwithout settingMSBuildSDKsPathI am able to reproduce the issue.
exporting environment variable shall also work.Output of
dotnet --info:.NET Core SDK (reflecting any global.json): Version: 2.2.108 Commit: 33ed5b90ce Runtime Environment: OS Name: arch OS Version: OS Platform: Linux RID: arch-x64 Base Path: /opt/dotnet/sdk/2.2.108/ Host (useful for support): Version: 2.2.6 Commit: 7dac9b1b51 .NET Core SDKs installed: 2.2.108 [/opt/dotnet/sdk] .NET Core runtimes installed: Microsoft.NETCore.App 2.2.6 [/opt/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-downloadplease let me know if you need some more information for the bugfix. +1
Excellent!!! Since my dotnet version is preview, I used this in "~/.profile": export DOTNET_ROOT=$HOME/dotnet export PATH=$PATH:$HOME/dotnet export MSBuildSDKsPath=$HOME/dotnet/sdk/$(dotnet --version)/Sdks
Now I can use "code" command as before.
I have used this fix until now but with the last version of omnisharp this workaround doesn't work any more.
I got this issue:
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /home/gpad/workspace/gpad/azure_service_bus/lb/lb.csproj
It was not possible to find any installed .NET Core SDKs
Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from:
https://aka.ms/dotnet-download
Omnisharp 1.21.4
I have used this fix until now but with the last version of omnisharp this workaround doesn't work any more.
I got this issue:
[info]: OmniSharp.MSBuild.ProjectManager Loading project: /home/gpad/workspace/gpad/azure_service_bus/lb/lb.csproj It was not possible to find any installed .NET Core SDKs Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: https://aka.ms/dotnet-downloadOmnisharp 1.21.4
Same issue here, started last week.
vscode displays this error but all editor functions continue to work.
I use this workaraound (thanks to @gpad tips) setting MSBuildSDKsPath, DOTNET_ROOT and PATH environment variables before opening VSCode.
I use asdf to manage dotnet installation, I run this script (I put inside a function in my .zshrc) before running VSCode:
function set-dotnet-vars {
DOTNET_BASE=$(dotnet --info | grep "Base Path" | awk '{print $3}')
echo "DOTNET_BASE: ${DOTNET_BASE}"
DOTNET_ROOT=$(echo $DOTNET_BASE | sed -E "s/^(.*)(\/sdk\/[^\/]+\/)$/\1/")
echo "DOTNET_ROOT: ${DOTNET_ROOT}"
export MSBuildSDKsPath=${DOTNET_BASE}Sdks/
export DOTNET_ROOT=$DOTNET_ROOT
export PATH=$DOTNET_ROOT:$PATH
}
Having same issues. Setting SDK path helps but still having issues. OmniSharp will now load correctly but I still cannot launch a debug session. Any ideas is much appreciated!
Thanks a lot @PaoloLaurenti. Worked perfectly. The only change I made was to place the contents of this function inside the code binary (located in /usr/bin/code), so I wouldn't have to remember to run the function every time before opening a .Net Core project in VSCode.
@PaoloLaurenti, thank you for the great tip. I've been wondering about this for ages. asdf offers a convenient way to compute DOTNET_ROOT, so here is a simplified version of the script that I put in my .bashrc:
export DOTNET_ROOT="$(asdf where dotnet-core)"
DOTNET_VERSION="$(basename $DOTNET_ROOT)"
export MsBuildSDKsPath="$DOTNET_ROOT/sdk/$DOTNET_VERSION/Sdks"
export PATH="$DOTNET_ROOT:$PATH" # I suspect this is not necessary.
I see from the OmniSharp log in VSCode that OmniSharp finds the correct .NET Core SDK:
[info]: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to "$(asdf where dotnet-core)/dotnet"
However, at face value it doesn't appear that the MSBuildSDKsPath environment variable gets used:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 17.1.0 - "~/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '~/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
I feel like I'm overlooking something obvious here if anyone has any suggestions.
is it still not resolved?
having same issue - vs code running on WSL, unable to find dotnet managed by asdf