Closed MicKramer closed 4 years ago
what is the content of your csproj file? the warning says that you have 'Microsoft.NETCore.App' there which is not needed in 3.0.
also can you please set omnisharp.logginglevel to "debug" and post the output again?
I found the same issue on OSX on a dotnet new webapi
generated project.
I followed the steps above for comparison. I additionally added the debug flag.
VSCode version: 1.38.1 C# Extension: 1.21.3
I have the same issue both on Windows 10 Enterprise Edition and Fedora 30. Both environments are updated and the latest versions of VSCode, C# Extension and .Net Core SDK are installed.
Please see below the logs from my Fedora 30 machine:
VSCode version: 1.38.1 C# Extension: 1.21.3
It might help if I add that everytime I open a netcoreapp3.0 application, C# extension keeps showing the following message: "There are unresolved dependencies. Please execute the restore command to continue."
Any help would be highly appreciated.
can you post the content of the csproj file?
This is what I see:
when using:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
Please see below as the content of my csproj file:
<Project` Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
I would really like to help but I can't reproduce this on any system 😀 We have been supporting .NET Core 3.0 since preview 1 and there have been no special changes from last RC1 to GA version - and any issues reported with NET Core 3.0 over the last months have been continually fixed.
The warning Did not find 'Microsoft.NETCore.App' in lock file.
normally only happened when you had Microsoft.NETCore.App
in the csproj file (like it was normal in older versions of .NET Core) - in .NET Core 3.0 it's no longer needed (it was removed around preview 6 I think). Also, even if that warning is there, you might see the annoying "There are unresolved dependencies. Please execute the restore command to continue." message but even that should not impact intellisense anyway.
I will continue to look into this but it would be great to get any more info from anyone experiencing this.
I looked in folder "/home/masoud/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/" to see if I have MSBuild version 16 there. I checked the MSBuild.dll.config file and the contents of this file looks wrong.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="msbuildToolsets" type="Microsoft.Build.Evaluation.ToolsetConfigurationSection, Microsoft.Build, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
</startup>
<runtime>
<AppContextSwitchOverrides value="Switch.System.IO.UseLegacyPathHandling=false;Switch.System.IO.BlockLongPaths=false" />
<DisableFXClosureWalk enabled="true" />
<generatePublisherEvidence enabled="false" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Framework" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Tasks.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Utilities.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Engine" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Build.Conversion.Core" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="15.1.0.0" />
</dependentAssembly>
<!-- Redirects for facade assemblies -->
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" culture="neutral" publicKeyToken="b77a5c561934e089" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<!-- Redirects for components dropped by Visual Studio -->
<dependentAssembly>
<assemblyIdentity name="Microsoft.Activities.Build" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="15.0.0.0" />
<codeBase version="15.0.0.0" href=".\amd64\Microsoft.Activities.Build.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="XamlBuildTask" culture="neutral" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="4.0.0.0" newVersion="15.0.0.0" />
<codeBase version="15.0.0.0" href=".\amd64\XamlBuildTask.dll" />
</dependentAssembly>
<!-- Workaround for crash in C++ CodeAnalysis scenarios due to https://github.com/Microsoft/msbuild/issues/1675 -->
<dependentAssembly>
<assemblyIdentity name="FxCopTask" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<codeBase version="15.0.0.0" href="..\..\Microsoft\VisualStudio\v15.0\CodeAnalysis\FxCopTask.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.CodeAnalysis" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<codeBase version="15.0.0.0" href="..\..\Microsoft\VisualStudio\v15.0\CodeAnalysis\Microsoft.VisualStudio.CodeAnalysis.dll" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.CodeAnalysis.Sdk" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<codeBase version="15.0.0.0" href="..\..\Microsoft\VisualStudio\v15.0\CodeAnalysis\Microsoft.VisualStudio.CodeAnalysis.Sdk.dll" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Data.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.Tracing" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Globalization.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Sockets" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.Serialization.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Security.Cryptography.Algorithms" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Security.SecureString" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Threading.Overlapped" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.0.0" newVersion="4.1.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<!-- To define one or more new toolsets, add an 'msbuildToolsets' element in this file. -->
<msbuildToolsets default="15.0">
<toolset toolsVersion="15.0">
<property name="MSBuildToolsPath" value="$([MSBuild]::GetCurrentToolsDirectory())" />
<property name="MSBuildToolsPath32" value="$([MSBuild]::GetToolsDirectory32())" />
<property name="MSBuildToolsPath64" value="$([MSBuild]::GetToolsDirectory64())" />
<property name="MSBuildSdksPath" value="$([MSBuild]::GetToolsDirectory32())\Sdks" />
<property name="MSBuildRuntimeVersion" value="4.0.30319" />
<property name="VisualStudioVersion" value="15.0" />
<property name="RoslynTargetsPath" value="$([MSBuild]::GetToolsDirectory32())\Roslyn" />
<projectImportSearchPaths>
<searchPaths os="windows">
<property name="MSBuildExtensionsPath" value="$(MSBuildProgramFiles32)\MSBuild" />
<property name="MSBuildExtensionsPath32" value="$(MSBuildProgramFiles32)\MSBuild" />
<property name="MSBuildExtensionsPath64" value="$(MSBuildProgramFiles32)\MSBuild" />
<property name="VSToolsPath" value="$(MSBuildProgramFiles32)\MSBuild\Microsoft\VisualStudio\v$(VisualStudioVersion)" />
</searchPaths>
<searchPaths os="osx">
<property name="MSBuildExtensionsPath" value="/Library/Frameworks/Mono.framework/External/xbuild/" />
<property name="MSBuildExtensionsPath32" value="/Library/Frameworks/Mono.framework/External/xbuild/" />
<property name="MSBuildExtensionsPath64" value="/Library/Frameworks/Mono.framework/External/xbuild/" />
<property name="VSToolsPath" value="/Library/Frameworks/Mono.framework/External/xbuild/Microsoft/VisualStudio/v$(VisualStudioVersion)" />
</searchPaths>
</projectImportSearchPaths>
</toolset>
</msbuildToolsets>
</configuration>
It looks like the MSBuild located in the path that C# extension is referencing it is version 15 not 16?
Thanks.
It is version 16, however MsBuild 16 has assembly version 15.1.
I see! Thanks :)
If you are on Linux or MacOS you may want to try install Mono 6.0.0 https://www.mono-project.com/download/stable/
Thank you. Come to think of it: I also have Visual Studio 2017 installed (version 15.9.14 running in .NET Framework 4.8.03752. Is it "cross contamination in my PATH so MSBuild from VS Studio is impacting?
No, the built in MsBuild is given preference over Visual Studio 2017. If you had Visual Studio 2019 installed though, then it would be used over the bundled MsBuild.
And I checked: No VS 2019 installed, nor previews. BTW: I'm running straight Windows 10 on MS Surface Laptop i5. Very ordinary personal laptop.
can you also post the contents of the obj/project.assets.json
file?
Sure, and screenshot of VS Code - coming up in a moment - - -
I have the same issue both on Windows 10. Both environments are updated and the latest versions of VSCode, C# Extension and .Net Core SDK are installed.
VSCode version: 1.38.1
C# Extension: 1.21.3
Net Core: 3.0
Note on screenshot: Taken after I copied .csproj/.cs files for drag-and-drop into this thread.
I have the same issue on Windows 10. I use the new version .NET Core 3.0
and just create the new console app by dotnet new console
. And open the VS Code, then got the error.
VSCode version: 1.38.1 C# Extension: 1.21.3
if you are Windows, I believe the workaround will be to install Visual Studio 2019 (latest - 16.3) https://visualstudio.microsoft.com/vs/ Once full VS is on your machine, OmniSharp will use MsBuild from there to resolve the metadata of your projects.
OK, will do. Right now checking MSBuild's in my path. Install VS 2019 may take hours due to my web access speed. Search+compare takes minutes. And since several others have similar problem finding exact point-of-conflict could be helpful.
if you are Windows, I believe the workaround will be to install Visual Studio 2019 (latest - 16.3) https://visualstudio.microsoft.com/vs/ Once full VS is on your machine, OmniSharp will use MsBuild from there to resolve the metadata of your projects.
Really! I goes to updated my VS 2019, and all problem are fixed. But is there anyway to split VS Code and VS? I don't want update the VS 2019 everytime (take too long time). What can i setting for VS Code(Omnisharp)? Thanks.
Thanks a lot for confirming 👍
If anyone experiences this problem on *nix platforms I believer this should help too https://github.com/OmniSharp/omnisharp-vscode/issues/3289#issuecomment-534396993
OmniSharp ships with an embedded MSBuild which for various reasons is somewhat limited - it should work however for more basic scenarios like shown here. If we find VS2019 (Windows) or Mono 5.18.1+ (Linux, MacOS) on the machine, we use that instead.
We are investigating how we can bring the embedded MSBuild up to speed here and what goes wrong there.
Thanks a lot for confirming 👍
If anyone experiences this problem on *nix platforms I believer this should help too #3289 (comment)
OmniSharp ships with an embedded MSBuild which for various reasons is somewhat limited - it should work however for more basic scenarios like shown here. If we find VS2019 (Windows) or Mono 5.18.1+ (Linux, MacOS) on the machine, we use that instead.
We are investigating how we can bring the embedded MSBuild up to speed here and what goes wrong there.
I'll give this a go once I'm back home.
I'm experiencing the same issue on Ubuntu 18.04.
$ dotnet --version
3.0.100
$ dotnet new console -o hello
$ cd hello
$ more hello.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup>
</Project>
$ dotnet run
Hello World!
But I open in vscode 1.38.1 with ms-vscode.csharp extension version 1.21.3 I get the same warning as other people in the OmniSharp Log:
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
hello: Did not find 'Microsoft.NETCore.App' in lock file.
I also get unresolved dependencies asking me to restore and intellisense not working with lots of errors similar to the following one:
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?) (CS0246) [hello]
Installing mono-devel from Mono 6.0.0 Stable (https://www.mono-project.com/download/stable/) fixed the issue, but it needs another 365 MB disk space.
if you are Windows, I believe the workaround will be to install Visual Studio 2019 (latest - 16.3) https://visualstudio.microsoft.com/vs/ Once full VS is on your machine, OmniSharp will use MsBuild from there to resolve the metadata of your projects.
Still not working on my Windows 10 even with VS19 installed. Please see the OmniSharp log below:
Starting OmniSharp server at 24/09/2019, 08:56:08
Target: e:\Learning Base\Testing Area\Test
OmniSharp server started.
Path: C:\Users\mdehghani\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\OmniSharp.exe
PID: 11036
[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 4 MSBuild instance(s)
1: Visual Studio Enterprise 2017 15.9.28307.858 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
2: Visual Studio Build Tools 2017 15.9.28307.858 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
3: Visual Studio Community 2019 16.2.29306.81 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
4: StandAlone 16.0 - "C:\Users\mdehghani\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.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 'e:\Learning Base\Testing Area\Test'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'e:\Learning Base\Testing Area\Test'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'e:\Learning Base\Testing Area\Test\Test.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'e:\Learning Base\Testing Area\Test'.
[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: e:\Learning Base\Testing Area\Test\Test.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 'e:\Learning Base\Testing Area\Test' on host 11992.
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'e:\Learning Base\Testing Area\Test\Test.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project 'e:\Learning Base\Testing Area\Test\Test.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: Test
[warn]: OmniSharp.MSBuild.PackageDependencyChecker
Test: Did not find 'Microsoft.NETCore.App' in lock file.
AND - Install VS 2019 Community edition solved issue on my laptop as well. My conclusion: Somewhere this C# Extension (or OmniSharp) has a dependency on installation that sometimes fails. Anyways, off for work … Thx @filipw and others!
Just a note that if I uninstalled dotnet-sdk-2.2 (so that I only have dotnet-sdk-3.0 installed) I get a different error in the OmniSharp Log:
The SDK 'Microsoft.NET.Sdk' specified could not be found
I could then fix the issue by making omnisharp use the legacy SDK resolver as mentioned in https://github.com/OmniSharp/omnisharp-vscode/issues/3160#issuecomment-517057835
I think, that best way to solve the problem is to wait till OmniSharp will roll-out the uppdate for their extension with standalone 16.0+ msbuild package. As for me, I see, that extension uses this one:
Registered MSBuild instance: StandAlone 16.0
and I am 100% sure that it is a reason (16.3 is for .NET Core, as I know). I face this problem on corporate laptop where VS2017 is installed, but everything works fine on my PC with VS 2019.3.
Try to copy bin folder
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\16.3
from VS 2019.3 version to something like that:
.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current
It can help for now, I think, but I an try this trick only after work.
This is my OmniSharp log after uninstalling all other .net core sdks and only having version 3 installed:
Starting OmniSharp server at 24/09/2019, 09:48:39
Target: e:\Learning Base\Testing Area\Test
OmniSharp server started.
Path: C:\Users\mdehghani\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\OmniSharp.exe
PID: 12960
[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 4 MSBuild instance(s)
1: Visual Studio Enterprise 2017 15.9.28307.858 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin"
2: Visual Studio Build Tools 2017 15.9.28307.858 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
3: Visual Studio Community 2019 16.2.29306.81 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
4: StandAlone 16.0 - "c:\Users\mdehghani\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.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 'e:\Learning Base\Testing Area\Test'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'e:\Learning Base\Testing Area\Test'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for 'e:\Learning Base\Testing Area\Test\Test.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'e:\Learning Base\Testing Area\Test'.
[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: e:\Learning Base\Testing Area\Test\Test.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 'e:\Learning Base\Testing Area\Test' on host 15880.
[warn]: OmniSharp.MSBuild.ProjectManager
Failed to load project file 'e:\Learning Base\Testing Area\Test\Test.csproj'.
e:\Learning Base\Testing Area\Test\Test.csproj(1,1)
Microsoft.Build.Exceptions.InvalidProjectFileException: The SDK 'Microsoft.NET.Sdk' specified could not be found. e:\Learning Base\Testing Area\Test\Test.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, SdkResult& sdkResult, Boolean throwOnFileNotExistsError)
at Microsoft.Build.Evaluation.Evaluator`4.ExpandAndLoadImports(String directoryOfImportingFile, ProjectImportElement importElement, SdkResult& sdkResult)
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, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project.Initialize(IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary`2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings, EvaluationContext evaluationContext)
at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary`2 globalProperties, String toolsVersion)
at OmniSharp.MSBuild.ProjectLoader.EvaluateProjectFileCore(String filePath) in C:\projects\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectLoader.cs:line 129
at OmniSharp.MSBuild.ProjectLoader.BuildProject(String filePath) in C:\projects\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectLoader.cs:line 72
at OmniSharp.MSBuild.ProjectFile.ProjectFileInfo.Load(String filePath, ProjectIdInfo projectIdInfo, ProjectLoader loader) in C:\projects\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectFile\ProjectFileInfo.cs:line 98
at OmniSharp.MSBuild.ProjectManager.LoadOrReloadProject(String projectFilePath, Func`1 loader) in C:\projects\omnisharp-roslyn\src\OmniSharp.MSBuild\ProjectManager.cs:line 308
[fail]: OmniSharp.MSBuild.ProjectManager
Attempted to update project that is not loaded: e:\Learning Base\Testing Area\Test\Test.csproj
you could try adding omnisharp.json
file:
{
"MSBuild": {
"UseLegacySdkResolver": true
}
}
and see if it helps
you could try adding
omnisharp.json
file:{ "MSBuild": { "UseLegacySdkResolver": true } }
and see if it helps
Thanks. It helped! I'm going to try this on my Fedora machine as well. I'm going to uninstall .net core 2 and only have version 3 installed and see if this workaround works there as well.
Guys, I've got the solution (for those, who don't want to install VS2019).
After it I get this output:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 3 MSBuild instance(s)
1: Visual Studio Professional 2017 15.9.28307.858 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin"
2: Visual Studio Build Tools 2019 16.3.29318.209 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
3: StandAlone 16.0 - "C:\Users\*********\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Build Tools 2019 16.3.29318.209 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
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.
I got it fixed on Fedora 30 just by removing .net core 2.2 and only having .net core 3 installed.
While working with Blazor, adding omnisharp.json wasn't enough, I had to install de 2019 build tools.
Guys, I've got the solution (for those, who don't want to install VS2019).
1. Go to [Microsoft VS downloads](https://visualstudio.microsoft.com/downloads/). 2. Download "Build Tools for Visual Studio 2019", then install it. 3. Go to modify -> Individual components, ccheck ".NET Core 3.0 SDK". Install. 4. Start your VS Code and have fun.
After it I get this output:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Located 3 MSBuild instance(s) 1: Visual Studio Professional 2017 15.9.28307.858 - "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin" 2: Visual Studio Build Tools 2019 16.3.29318.209 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin" 3: StandAlone 16.0 - "C:\Users\*********\.vscode\extensions\ms-vscode.csharp-1.21.3\.omnisharp\1.34.3\.msbuild\Current\Bin" [info]: OmniSharp.MSBuild.Discovery.MSBuildLocator Registered MSBuild instance: Visual Studio Build Tools 2019 16.3.29318.209 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin"
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.
I'm using Chocolatey, so to do this I installed visualstudio2019buildtools and visualstudio2019-workload-netcorebuildtools. Anyone who uses it probably would just need the to install the last one, because it already has the first as a dependency. :)
Uninstalling all but 3.x and doing the comment by @filipw worked for me on Windows.
For anyone finding this a bit later. I was using VSCode on Mac OS.... I had mono 6.0.0 installed and had the red lines everywhere. Upgraded to 6.4.0 stable (Visual Studio Version) and it's working great. No red lines.
Issue 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
Actions in Command Prompt
dotnet new console
dotnet build
=> builds successfullydotnet run
=> runs successfullyOpen VS Code in this folder
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
[warn]: OmniSharp.MSBuild.PackageDependencyChecker OmniDemo: Did not find 'Microsoft.NETCore.App' in lock file.
[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: 04339c3a26 Runtime 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-downloadVisual 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|;