-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omnisharp tries to use MSBuild < 16.3 from Visual Studio 2019 in .NET Core 3.x projects #1700
Comments
forgot to add C# output. Here it goes Installing C# dependencies... Downloading package 'OmniSharp for Windows (.NET 4.6 / x64)' (32146 KB).................... Done! Downloading package '.NET Core Debugger (Windows / x64)' (47489 KB).................... Done! Downloading package 'Razor Language Server (Windows / x64)' (50022 KB).................... Done! Finished |
Hi @andremarcondesteixeira, |
I don't get it. Shouldn't VS Code be separeted from Visual Studio? |
I think it's a bug, because Omnisharp is trying to use the environment from another IDE. The extension is a VS Code extension, but is affected by Visual Studio not supporting dotnet core |
In order to support both Full Framework and .NET Core projects, we rely on the Full Framework MSBuild. We package a minimal MSBuild with OmniSharp (it is prohibitive to include a full MSBuild because of the size), but defer to a full installation when one is found on your machine, since it will have all build tasks and target files included. In this case it is just an unfortunate circumstance that the Full Framework MSBuild you have installed does not support the newer .NET Core SDK that you are using. |
Is there any way I can help with this? |
@andremarcondesteixeira, The best solution is to either update your Visual Studio (lots of improvements since VS16.2) or you could install the latest Visual Studio Build Tools to get a version of MSBuild that supports .NET Core 3.1. |
Shouldn't there be a fallback to the VS Code version of MSBuild upon error? I have VS installed and user-mode VS Code installed, and do not have local admin rights. So I cannot update Visual Studio. |
@symbiogenesis You can force the use of the minimal MSBuild by creating a omnisharp.json file in your C:\Users{Your username}.omnisharp folder omnisharp.json (update version numbers as appropriate) {
"MSBuild": {
"msbuildoverride": {
"MSBuildPath": "C:\\Users\\{your username}\\.vscode\\extensions\\ms-vscode.csharp-1.21.10\\.omnisharp\\1.34.10\\.msbuild\\Current\\Bin",
"Name": "OmniSharp MSBuild",
"PropertyOverrides": {
"MSBuildExtensionsPath": "C:\\Users\\{your username}\\.vscode\\extensions\\ms-vscode.csharp-1.21.10\\.omnisharp\\1.34.10\\.msbuild"
}
}
}
} |
Would be great to have a boolean setting for this, so that I won't need to update the MSBuildPath on every upgrade. |
We periodically raise the minimum version of VS that can be discovered and used. For example VS 2017 is never used anymore, even though it used to be. This "issue" will go away on its own once we raise the minimum VS 2019 version to 16.3 which I think we will do soon. But as mentioned, it will resolve itself once we raise the minimum VS 2019 version. Also, I will move this issue to the server repo as it belongs there. |
@JoeRobich @david-driscoll @mholo65 should we just raise the min. VS to 16.3 and be done with this? it should help avoid a bunch of those .NET Core 3.x issues omnisharp-roslyn/src/OmniSharp.Host/MSBuild/Discovery/Extensions.cs Lines 97 to 101 in 61d7b82
|
@filipw I'm ok with raising the min version to 16.3... Best would be if we could check what the target framework is and then set min version to 16.3 if project targets .NET Core 3.x. Problem is that we know the target framework after project have been processed by |
@filipw I'm ok with the change. I think it is reasonable to expect late adopters to at least keep up with the last LTS release and 16.4 was an LTS release for us. |
do you have maybe access to some telemetry on how installations of 16.x versions are distributed? |
@filipw Of users who report telemetry, they are overwhelmingly using VS16.3+ |
FYI I'm seeing similar issues now that dotnet 5 dropped. Even though I have StandAlone 16.8.0 installed, it must be using an old Visual Studio Community 2019 16.6.30204.135. The omnisharp.json file didn't work for me, and I agree with the prior sentiment that I don't want to keep that file up to date as versions increase. Trying to load a simple test project for net5.0 Omnisharp log: |
It is a chicken and egg situation. OmniSharp doesn't know the version of the framework since it needs MSBuild for that. Unfortunately the lowest compatible version with .NET Core 3.1 is 16.3 and the lowest compatible with .NET 5.0 is 16.8. For now we select 16.3 as the lowest since most people use .NET Core 3.1 but it will be raised to 16.8 in the future. The stand alone 16.8 that is bundled with Omnisharp is a minimal instance that doesn't contain desktop references or doesn't support Unity development, therefore we always select the instance from Visual Studio if it's there and it's > 16.3. My recommendation is to just upgrade VS to latest - VS 16.8 is available since last week, and, in fact, should auto popup the update notification. If overriding by hand with omnisharp.json doesn't work for for you please open a new issue with repro steps and OmniSharp log - thanks. |
Thanks, @filipw. I just upgraded my VS 2019 install. Size of the download was ridiculous, though. Everything is working and I have intellisense in VSCode again. |
Issue Description
Starting a console project from scratch using the command line tools results in code that Intelisense thinks is wrong. There red lines everywhere, even though the code compiles and runs with no problem.
Steps to Reproduce
dotnet new console
Expected Behavior
No errors should be present
Actual Behavior
Intelisense show errors everywhere
Logs
OmniSharp log
Starting OmniSharp server at 29/01/2020 10:36:05
Target: d:\Documents\teste
OmniSharp server started.
Path: c:\Users\Andre.vscode\extensions\ms-vscode.csharp-1.21.9.omnisharp\1.34.9\OmniSharp.exe
PID: 7248
Starting OmniSharp on Windows 6.2.9200.0 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2019 16.2.29306.81 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
2: StandAlone 16.3 - "c:\Users\Andre.vscode\extensions\ms-vscode.csharp-1.21.9.omnisharp\1.34.9.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2019 16.2.29306.81 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'd:\Documents\teste'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'd:\Documents\teste'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\Documents\teste\teste.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'd:\Documents\teste'.
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:\Documents\teste\teste.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.EditorConfigWorkspaceOptionsProvider, Order: 200
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'd:\Documents\teste' on host 4164.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\Documents\teste\teste.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'd:\Documents\teste\teste.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: teste
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
teste: Did not find 'Microsoft.NETCore.App' in lock file.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\Documents\teste\teste.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: d:\Documents\teste\teste.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\Documents\teste\teste.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Update project: teste
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
teste: Did not find 'Microsoft.NETCore.App' in lock file.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\Documents\teste\teste.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: d:\Documents\teste\teste.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\Documents\teste\teste.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Update project: teste
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
teste: Did not find 'Microsoft.NETCore.App' in lock file.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\Documents\teste\teste.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: d:\Documents\teste\teste.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\Documents\teste\teste.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Update project: teste
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
teste: Did not find 'Microsoft.NETCore.App' in lock file.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\Documents\teste\teste.csproj'
info: OmniSharp.MSBuild.ProjectManager
Loading project: d:\Documents\teste\teste.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\Documents\teste\teste.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Update project: teste
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
teste: Did not find 'Microsoft.NETCore.App' in lock file.
C# log
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: b377529961Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
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:
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [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.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 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.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 3.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.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
The text was updated successfully, but these errors were encountered: