View previous topic :: View next topic |
Author |
Message |
MALDATA n00b
Joined: 07 Apr 2011 Posts: 53
|
Posted: Sun Feb 17, 2019 6:27 pm Post subject: vscode / omnisharp fails to load project |
|
|
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:
app-editors/visual-studio-code
dev-dotnet/dotnetcore-sdk-bin
dev-util/msbuild
When I start vscode and install the C# extension, it pulls in OmniSharp, and OmniSharp fails to start with the following error:
Code: | 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=4.5.24.0, 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:
Code: | 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
Code: | <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" /> |
which seems like it should be changed to
Code: | <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 |
|
|
h017ah n00b
Joined: 18 Apr 2007 Posts: 46
|
Posted: Wed Apr 10, 2019 1:48 pm Post subject: |
|
|
Since this post comes up when you Google, I thought I should post my findings at least. It is possible to get vscode working.
Code: |
$ 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 .dll.so 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 |
|
|
saboya Guru
Joined: 28 Nov 2006 Posts: 552 Location: Brazil
|
Posted: Sat May 11, 2019 2:36 pm Post subject: |
|
|
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:
Code: | # equery files --tree msbuild
* Searching for msbuild ...
* Contents of dev-util/msbuild-15.3-r3:
/usr
> /bin
+ msbuild
> /lib64
> /mono
> /gac
> /Microsoft.Build
> /15.3.0.0__0738eb9f132ed756
+ 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:
Code: | <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:
Code: | # equery belongs /usr/lib/mono/xbuild/15.0
* Searching for /usr/lib/mono/xbuild/15.0 ...
dev-lang/mono-5.16.0.220 (/usr/lib/mono/xbuild/15.0)
|
|
|
Back to top |
|
|
|
|
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
|
|