C# Extension fails only for netcoreapp3.0 GA
See original GitHub issueIssue Description
C# Extensions complains “The type or namespace name ‘System’ could not be found …” (likewise System.String, System.Object, System.Void, etc.)
This happens only when Target Framework = netcoreapp3.0. No problems for netcoreapp2.0, netcoreapp2.1, nor netcoreapp2.2. Code builds and runs fine at command prompt.
Steps to Reproduce
- Installed software
- VS Code latest (1.38.1)
- C# Extensions latest (1.21.3)
- . . . with OmniSharp latest (1.34.3)
- .NET Core 3.0 SDK (3.0.100)
- Restart workstation after installs (just in case)
- Actions in Command Prompt
- Create folder = OmniDemo
- Create new console app in that folder:
dotnet new console
dotnet build
=> builds successfullydotnet run
=> runs successfully- Inspect .csproj file => App uses TargetFramework = netcoreapp3.0.
- Open VS Code in this folder
- Warning = No assets … => Accept to add assets
- Warning = Unresolved dependencies => Accept to restore
- Warning (repeated) = Unresolved dependencies => Accept to restore
Expected Behavior
C# Extensions displays c# code without any errors independent of whether TargetFramework = netcoreapp3.0, 2.2, 2.1, or 2.0.
Actual Behavior
C# Extensions accepts code for 2.0, 2.1, and 2.2.
For netcoreapp3.0 completely different behavior => C# Extensions complains of syntax errors (no type or namespace name) for System, System.String, System.Object, System.Void, etc.
Logs
OmniSharp log
Starting OmniSharp server at 9/23/2019, 11:34:25 PM Target: c:\DEV\OmniDemo
OmniSharp server started. Path: C:\Users\mickr.vscode\extensions\ms-vscode.csharp-1.21.3.omnisharp\1.34.3\OmniSharp.exe PID: 13104
Starting OmniSharp on Windows 6.2.9200.0 (x64)
DotNetPath set to dotnet
Located 2 MSBuild instance(s)
1: Visual Studio Community 2017 15.9.28307.770 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin"
2: StandAlone 16.0 - "c:\Users\mickr\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin"
MSBUILD_EXE_PATH environment variable set to 'c:\Users\mickr\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin\MSBuild.exe'
Registered MSBuild instance: StandAlone 16.0 - "c:\Users\mickr\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin"
CscToolExe = csc.exe
CscToolPath = c:\Users\mickr\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin\Roslyn
MSBuildExtensionsPath = c:\Users\mickr\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild
MSBuildToolsPath = c:\Users\mickr\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin
Detecting Cake files in 'c:\DEV\OmniDemo'.
Could not find any Cake files
No solution files found in 'c:\DEV\OmniDemo'
Queue project update for 'c:\DEV\OmniDemo\OmniDemo.csproj'
Detecting CSX files in 'c:\DEV\OmniDemo'.
Could not find any CSX files
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
Loading project: c:\DEV\OmniDemo\OmniDemo.csproj
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
Configuration finished.
Omnisharp server running using Stdio at location 'c:\DEV\OmniDemo' on host 3140.
Successfully loaded project file 'c:\DEV\OmniDemo\OmniDemo.csproj'.
Adding project 'c:\DEV\OmniDemo\OmniDemo.csproj'
Update project: OmniDemo
[warn]: OmniSharp.MSBuild.PackageDependencyChecker OmniDemo: Did not find ‘Microsoft.NETCore.App’ in lock file. info: OmniSharp.MSBuild.ProjectManager Queue project update for ‘c:\DEV\OmniDemo\OmniDemo.csproj’ info: OmniSharp.MSBuild.ProjectManager Loading project: c:\DEV\OmniDemo\OmniDemo.csproj info: OmniSharp.MSBuild.ProjectManager Successfully loaded project file ‘c:\DEV\OmniDemo\OmniDemo.csproj’. info: OmniSharp.MSBuild.ProjectManager Update project: OmniDemo [warn]: OmniSharp.MSBuild.PackageDependencyChecker OmniDemo: Did not find ‘Microsoft.NETCore.App’ in lock file.
C# log
C# log is EMPTY
Environment information
VSCode version: 1.38.1 C# Extension: 1.21.3
Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.0.100 Commit: 04339c3a26Runtime 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: 2.1.403 [C:\Program Files\dotnet\sdk] 2.1.500 [C:\Program Files\dotnet\sdk] 2.1.508 [C:\Program Files\dotnet\sdk] 2.2.300 [C:\Program Files\dotnet\sdk] 3.0.100 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.5 [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.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.5 [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
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
csharp | ms-vscode | 1.21.3 |
mssql | ms-mssql | 1.6.0 |
remote-wsl | ms-vscode-remote | 0.39.5 |
team | ms-vsts | 1.149.2 |
vscode-eslint | dbaeumer | 1.9.1 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:36 (10 by maintainers)
Top GitHub Comments
Guys, I’ve got the solution (for those, who don’t want to install VS2019).
After it I get this output:
So correct version of MSBuild is now used by OmniSharp. But don’t forget about step 3, solution need .Net Core 3.0 SDK for VisualStudio.
If you are on Linux or MacOS you may want to try install Mono 6.0.0 https://www.mono-project.com/download/stable/