Joined: 07 Apr 2011
|Posted: Sun Feb 17, 2019 6:27 pm Post subject: vscode / omnisharp fails to load project
I'm trying to get a good vscode setup going on my gentoo machine so I can play with C# development on .NET Core. I installed three packages from the dotnet overlay:
When I start vscode and install the C# extension, it pulls in OmniSharp, and OmniSharp fails to start with the following error:
|System.TypeLoadException: Could not load type of field 'OmniSharp.MSBuild.ProjectManager:_queue' (11) due to: Could not load file or assembly 'System.Threading.Tasks.Dataflow, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. |
Some googling led me to setting the omnisharp.useglobalmono value to "never," which forces it to use a mono which is bundled with the extension (?), and then I get a new error:
|Microsoft.Build.Exceptions.InvalidProjectFileException: The imported project "/usr/lib/mono/xbuild/15.0/Microsoft.Common.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. /opt/dotnet_core/sdk/2.2.103/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props |
This is true. /usr/lib/mono/xbuild/15.0/Microsoft.Common.props does NOT exist, but /usr/lib/mono/xbuild/15.0/Imports/Microsoft.Common.props DOES exist. So, if I get into /opt/dotnet_core/sdk/2.2.103/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props, I see the line
|<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> |
which seems like it should be changed to
|<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Imports\Microsoft.Common.props" /> |
but that doesn't actually fix the problem. I see a bug discussion here, and it seems to indicate that it can be fixed by installing msbuild, which I have done, or by downgrading mono, which I'm not interested in doing.
My best guess is that, instead of looking for Microsoft.Common.props in my system mono directory (/usr/lib/mono), it should be looking for it near whatever mono it actually uses when useglobalmono is set to never? I'm kinda grasping at straws.
Has anyone else seen this on gentoo and been able to fix it? Thanks!