Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
vscode / omnisharp fails to load project
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message

Joined: 07 Apr 2011
Posts: 48

PostPosted: Sun Feb 17, 2019 6:27 pm    Post subject: vscode / omnisharp fails to load project Reply with quote

Hi all,

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=, 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!
Back to top
View user's profile Send private message

Joined: 18 Apr 2007
Posts: 46

PostPosted: Wed Apr 10, 2019 1:48 pm    Post subject: Reply with quote

Since this post comes up when you Google, I thought I should post my findings at least. It is possible to get vscode working.


$ find .vscode -type l -ls
 11971432      4 lrwxrwxrwx   1  user     user           44 april  9 21:46 .vscode/extensions/ms-vscode.csharp-1.18.0/.omnisharp/1.32.11/omnisharp/msbuild/15.0/Bin/System.Threading.Tasks.Dataflow.dll -> ../../../System.Threading.Tasks.Dataflow.dll

It's not pretty, but you have to do this if you have mono installed if I understand it correctly. The that mono has does not have the same PublicKeyToken.

Another thing that has helped me is the environment variable "MSBuildSDKsPath" (if omnisharp struggles with finding targets and whatnot).

e.g. MSBuildSDKsPath=/opt/dotnet_core/sdk/3.0.100-preview3-010431/Sdks

Another thing to remember is that as of today (10th of April 2019) you still have to have OpenSSL 1.0 installed if you want to be able to debug your applications with vscode. If not, you'll get vsdbg-ui crashing when you try to apply a breakpoint.
Back to top
View user's profile Send private message

Joined: 28 Nov 2006
Posts: 496
Location: Brazil

PostPosted: Sat May 11, 2019 2:36 pm    Post subject: Reply with quote

I have this issue and I can't get it to work.

*edit* - Ok, after some more tinkering I managed to get it working (I guess). The thing is, installing msbuild doesn't work because msbuild installs the files we want in another location:

# equery files --tree msbuild
 * Searching for msbuild ...
 * Contents of dev-util/msbuild-15.3-r3:
   > /bin
      + msbuild
   > /lib64
      > /mono
         > /gac
            > /Microsoft.Build
               > /
                  + Microsoft.Build.dll
                  + Microsoft.Build.pdb
   > /share
      > /msbuild
         + MSBuild.exe
         + Microsoft.CSharp.CurrentVersion.targets
         + Microsoft.CSharp.targets
         + Microsoft.Common.CurrentVersion.targets
         + Microsoft.Common.overridetasks
         + Microsoft.Common.props
         + Microsoft.Common.targets
         + Microsoft.NETFramework.CurrentVersion.props
         + Microsoft.NETFramework.CurrentVersion.targets
         + Microsoft.NETFramework.props
         + Microsoft.NETFramework.targets

Changing /opt/dotnet_core/sdk/<VERSION>/Sdks/Microsoft.NET.Sdk/Sdk/Sdk.props line to:

<Import Project="\usr\share\msbuild\Imports\Microsoft.Common.props" />

Actually makes omnisharp work for me with Mono 5.16 installed. Not thoroughly tested, but it doesn't spill errors like before and it's actually recognizing code and pointing out errors.

And, FYI:

# equery belongs /usr/lib/mono/xbuild/15.0
 * Searching for /usr/lib/mono/xbuild/15.0 ...
dev-lang/mono- (/usr/lib/mono/xbuild/15.0)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum