vscode-csharp: .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
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 24
Commits related to this issue
- Set MSBuildSDKsPath environment variable OmniSharp isn't able to find SDKs otherwise (see https://github.com/OmniSharp/omnisharp-vscode/issues/2970#issuecomment-524292461) — committed to johannesegger/Main by johannesegger 5 years ago
- dotnet-sdk: Set MSBuildSDKsPath environment (#479) OmniSharp isn't able to find SDKs otherwise (see https://github.com/OmniSharp/omnisharp-vscode/issues/2970#issuecomment-524292461) — committed to ScoopInstaller/Main by johannesegger 5 years ago
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: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
✔️ 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 settingMSBuildSDKsPath
I am able to reproduce the issue.export
ing environment variable shall also work.Output of
dotnet --info
:please let me know if you need some more information for the bugfix. 👍
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.I also have this problem on Ubuntu 18.04 LTS, and this worked for me:
Same issue here, started last week.
vscode displays this error but all editor functions continue to work.
I have the same problem
omnisharp.json { “MsBuild”: { “UseLegacySdkResolver”: true } }
@rchande I see the same problem also with
"omnisharp.path": "1.32.16"
.I tried also with
"omnisharp.path": "latest"
. Nothing different.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?
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 😃
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?