.NET Core 3.1 app missing predefined types with VS2019 16.4.3 installed
See original GitHub issueIssue Description
This seems to be a common issue which usually has to do with not having an up-to-date version of Visual Studio 2019 installed. However, I do. This morning I updated my installations of Visual Studio to VS2017 15.9.14 and VS2019 16.4.3.
Yesterday the project was working correctly in VSCode.
Something about updating both VS2017 and VS2019 seems to have broken things. The log output indicates that it is selecting the correct MSBuild instance.
Steps to Reproduce
I have not verified that these will reproduce the issue on a fresh system, however it does repro with a brand new project created via dotnet new
:
- Latest versions of VS2017 Pro (15.9.14) and VS2019 (16.4.3)
dotnet new console --framework netcoreapp3.1
- Open project in VSCode w/ OmniSharp extension installed
Expected Behavior
A project not full of red squiggly errors about missing predefined types like System.Object.
Actual Behavior
A project full of red squiggly errors about missing predefined types like System.Object.
Logs
OmniSharp log
Starting OmniSharp server at 2020-01-28, 9:48:41 a.m.
Target: d:\BugReport
OmniSharp server started.
Path: C:\Users\REDACTED\.vscode\extensions\ms-vscode.csharp-1.21.9\.omnisharp\1.34.11-beta.7\OmniSharp.exe
PID: 9360
[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 3 MSBuild instance(s)
1: Visual Studio Professional 2017 15.9.28307.1000 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin"
2: Visual Studio Professional 2019 16.4.29709.97 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
3: StandAlone 16.3 - "C:\Users\meheler\.vscode\extensions\ms-vscode.csharp-1.21.9\.omnisharp\1.34.11-beta.7\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Professional 2019 16.4.29709.97 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin"
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'd:\BugReport'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'd:\BugReport'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\BugReport\BugReport.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'd:\BugReport'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: d:\BugReport\BugReport.csproj
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.EditorConfigWorkspaceOptionsProvider, Order: 200
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'd:\BugReport' on host 8228.
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\BugReport\BugReport.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'd:\BugReport\BugReport.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: BugReport
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
BugReport: Did not find 'Microsoft.NETCore.App' in lock file.
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 3.
C# log
Getting latest OmniSharp version information
Downloading package 'Latest OmniSharp Version Information' (1 KB).................... Done!
Environment information
VSCode version: 1.41.1 C# Extension: 1.21.9
Dotnet Information
.NET Core SDK (reflecting any global.json):
Version: 3.1.101
Commit: b377529961
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.101\
Host (useful for support):
Version: 3.1.1
Commit: a1388f194c
.NET Core SDKs installed:
1.1.14 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.508 [C:\Program Files\dotnet\sdk]
2.1.509 [C:\Program Files\dotnet\sdk]
2.1.511 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.108 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.101 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [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.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.1 [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 |
---|---|---|
beautify | HookyQR | 1.5.0 |
code-groovy | marlon407 | 0.1.2 |
comfortable-color-theme | yibuyisheng | 0.0.3 |
cpptools | ms-vscode | 0.26.3 |
csharp | ms-vscode | 1.21.9 |
debugger-for-chrome | msjsdiag | 4.12.6 |
EditorConfig | EditorConfig | 0.14.4 |
erlang | pgourlain | 0.5.2 |
henna | httpsterio | 0.10.0 |
Lua | keyring | 0.0.9 |
material-theme | zhuangtongfa | 3.2.1 |
mssql | ms-mssql | 1.8.0 |
parchment | lumiknit | 0.0.11 |
powershell | ms-vscode | 2020.1.0 |
puppet-vscode | jpogran | 0.22.0 |
python | ms-python | 2020.1.58038 |
remote-wsl | ms-vscode-remote | 0.41.7 |
ruby | rebornix | 0.26.0 |
tslint | eg2 | 1.0.44 |
vsc-community-material-theme | Equinusocio | 1.4.0 |
vsc-material-theme | Equinusocio | 32.4.0 |
vsc-material-theme-icons | equinusocio | 1.1.3 |
vscode-docker | ms-azuretools | 0.10.0 |
vscode-great-icons | emmanuelbeziat | 2.1.47 |
vscode-icons | vscode-icons-team | 9.7.0 |
vscode-markdownlint | DavidAnson | 0.33.0 |
vscode-ruby | wingrunr21 | 0.26.0 |
vscodeilviewer | josephwoodward | 0.0.1 |
xml | DotJoshJohnson | 2.5.0 |
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
phew! that’s great to hear. I started looking at the logic inside MSBuild at how it determines the build environment and got reminded that it is definitely not pretty. 😂
thanks for confirming
Ah, fiddlesticks. This one’s on me. My VS2017 MSBuild DLLs were in the GAC.
A while ago I had to add the VS2017 MSBuild assemblies to the GAC to resolve a different issue with running a .NET Core 1.x app in during a VS2015 project build, while 2017 was installed. I just forgot to uninstall them.
Removing them from the GAC got me up and running again. Thanks for your help and apologies for the confusion! I’ll close this out.