Skip to content
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 can not find assembly netstandard #3004

Closed
motor75 opened this issue Apr 17, 2019 · 25 comments
Closed

Omnisharp can not find assembly netstandard #3004

motor75 opened this issue Apr 17, 2019 · 25 comments

Comments

@motor75
Copy link

motor75 commented Apr 17, 2019

Issue Description

Upon starting up VS Code, I get an immediate error in the OmniSharp output indicating the following below. I reverted Omnisharp back to version 1.18 as per this Stack Overflow article, but I'm still getting the same error:

System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_1.

b__1()
at OmniSharp.HostHelpers.Start(Func`1 action) in D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:line 29

Steps to Reproduce

After OmniSharp update to 1.19, start VS Code and error occurs. Reverted back to 1.18 and error still occurs. This was not occurring 2 weeks ago.

Expected Behavior

No error should occur; Intellisense and inline errors should be displayed

Actual Behavior

The error above is produced; no intellisence nor inline errors are displayed.

OmniSharp log

OmniSharp server started.
Path: C:\Users\moserk.vscode\extensions\ms-vscode.csharp-1.18.0.omnisharp\3.5.0-beta.2219\OmniSharp.exe
PID: 7952

System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at OmniSharp.Stdio.Driver.Program.<>c__DisplayClass0_1.

b__1()
at OmniSharp.HostHelpers.Start(Func`1 action) in D:\a\1\s\src\OmniSharp.Host\HostHelpers.cs:line 29

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Post the output from Output-->OmniSharp log here

C# log

Getting latest OmniSharp version information
Downloading package 'Latest OmniSharp Version Information' (1 KB).................... Done!

Environment information

VSCode version: 1.33.1
C# Extension: 1.18.0

Dotnet Information .NET Core SDK (reflecting any global.json): Version: 2.2.203 Commit: e5bab63eca

Runtime Environment:
OS Name: Windows
OS Version: 10.0.15063
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.203\

Host (useful for support):
Version: 2.2.4
Commit: f95848e524

.NET Core SDKs installed:
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.103 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]
2.1.502 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.2.203 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
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.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
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.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.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.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
csharp ms-vscode 1.18.0
dotnet-test-explorer formulahendry 0.6.6
EditorConfig EditorConfig 0.13.0
vscode-nuget-package-manager jmrog 1.1.6
@jwerra
Copy link

jwerra commented Apr 17, 2019

The rollback to 1.18.0 worked for me, but be sure to set the preference "extensions.autoUpdate" to false or it will just reinstall 1.19.0

@filipw
Copy link
Contributor

filipw commented Apr 17, 2019

do you have .NET 4.7.2 installed? It appears to be the reason for this failure.

@motor75
Copy link
Author

motor75 commented Apr 17, 2019

I do have auto update turned off, so Omnisharp is at version 1.18.0

@motor75
Copy link
Author

motor75 commented Apr 17, 2019

It appears I have 4.7.2 installed...

C:\Windows\Microsoft.NET\Framework\v4.0.30319>.\msbuild.exe -version
Microsoft (R) Build Engine version 4.7.2046.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

4.7.2046.0

@mnewboult
Copy link

I can't install 4.7.2 (Windows 8.1). Installation fails. So I think I may be stuck on 1.18.0.

Microsoft seem to have forgotten developers are still using older OS versions.

@motor75
Copy link
Author

motor75 commented Apr 18, 2019

I have an update on this issue - I have now suddenly got the following error dialog box which was not appearing before when I attempt to open my project:
image

I clicked "YES" and installed the SDK for developers. Once installed, Omnisharp is now working fine.

Now, why it didn't show this error before and why it felt I needed to install the 4.7.2 framework when I apparently had it installed (based on my confirmation of such as shown in my previous comment above) is quite baffling. Although I would think this is unrelated, but my regular Visual Studio Enterprise installation requested an update yesterday to version 15.9.11. At the same time, Visual Studio Code also did an update for the April patches. It very well could have been one of these or a combination of these updates that caused my issue.

@SirIntruder
Copy link

Probably because of this:
OmniSharp/omnisharp-roslyn#1469

@filipw
Copy link
Contributor

filipw commented Apr 18, 2019

yes, you must have had "omnisharp.path":"latest" set in your VS Code, and it pulled down the latest build from master which is 1.32.19-beta.21 at the moment which had the linked change (OmniSharp/omnisharp-roslyn#1469). instead of OmniSharp crashing at startup silently, it should prompt now for the missing 4.7.2 on windows.

If you want to pin the version please use "omnisharp.path":"1.32.19-beta.21", this way you are guaranteed you fetch that version only.

@motor75
Copy link
Author

motor75 commented Apr 18, 2019

@SirIntruder you're probably correct - I see my file was updated today at 2:48pm (50 minutes ago) when I was still on version 1.18. No clue how it got updated, but it definitely has the 4.7.2 framework requirement in the config:

  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
  </startup>

Once everything started working again, I then allowed VS Code to do an update to 1.19 and I'm still good to go. Very odd sequence of events the last 2 days - I'd like to know what caused it and how to prevent it in the future.

@motor75
Copy link
Author

motor75 commented Apr 18, 2019

@filipw - I still have that in my settings:

"omnisharp.path": "latest"

Should it be set to something else?

@filipw
Copy link
Contributor

filipw commented Apr 18, 2019

I'd like to know what caused it and how to prevent it in the future.

Like I mentioned, the error was caused by the lack of .NET 4.7.2 on your Windows box (note, the version that you posted was just the msbuild version, not the .NET Framework version). Unfortunately we missed the supportedRuntime change as part of the OmniSharp release and instead of prompting the users that didn't have it to install it, it became a silent error that you experienced.

Apologies for the trouble. 😞

"omnisharp.path": "latest"

Should it be set to something else?

Have a look at my comment here, I try to explain the different possible settings OmniSharp/omnisharp-roslyn#1416 (comment)
Ideally you never need to set "omnisharp.path": "latest" because that by its definition will be unstable as it pulls the latest master build (not any official release).

Since you now have 4.7.2 wired in, it should be safe to remove that setting completely and just use the OmniSharp that's bundled with the 1.19.0 extension.
Hope this helps.

@motor75
Copy link
Author

motor75 commented Apr 18, 2019

@filipw - Awesome explanation - thanks for your help and detailed information :)

@Jacknq
Copy link

Jacknq commented Apr 19, 2019

Same issue, resolved disabling update and installing 1.18.0

@filipw
Copy link
Contributor

filipw commented Apr 23, 2019

This was resolved by OmniSharp/omnisharp-roslyn#1469
Until the next release, the workaround is to install .NET 4.7.2 or use the method described here #3004 (comment) which will prompt automatically for .NET 4.7.2 installation.

@GabrielBB
Copy link

GabrielBB commented May 2, 2019

I'm creating a Blazor project with .NET Core 3.0 following the official documentation: Get started with Blazor and having this issue. Why do i have to install .NET Framework 4.7.2 as a workaround if .NET Core is supposed to replace the .NET Framework? I'm not a .NET Developer but that is what i understood

@rchande
Copy link

rchande commented May 2, 2019

@GabrielBB OmniSharp, the component used by the C# Extension for VS Code to provide intellisense, runs on .NET Framework 4.7.2. Your Blazor project runs in .NET Core, but this particular development tool requires .NET Framework. Note that the fact that you have to manually determine that you need install 4.7.2 is a bug that we fixed in OmniSharp/omnisharp-roslyn#1469

@shkarface
Copy link

I have the same issue, but on linux

@luyseyal
Copy link

Ditto for Linux.


OmniSharp server started with Mono 5.18.1.
    Path: /home/luyseyal/.vscode/extensions/ms-vscode.csharp-1.20.0/.omnisharp/1.32.20/omnisharp/OmniSharp.exe
    PID: 4455

System.IO.FileNotFoundException: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
File name: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
  at OmniSharp.CommandLineApplication+<>c__DisplayClass11_0.<OnExecute>b__0 () [0x0000b] in <ed3c9ce4e617450c93f057d2d4910269>:0 
  at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00039] in <344a1e8cd6594b17b1e01f8df6ae8827>:0 
  at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable`1[T] args) [0x00042] in <ed3c9ce4e617450c93f057d2d4910269>:0 
  at OmniSharp.Stdio.Driver.Program+<>c__DisplayClass0_0.<Main>b__0 () [0x00028] in <8c53cc66f1ca4f63a09ec8173bd47c77>:0 
  at OmniSharp.HostHelpers.Start (System.Func`1[TResult] action) [0x0001c] in <ed3c9ce4e617450c93f057d2d4910269>:0 
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).

@luyseyal
Copy link

I think this is fixed if you install fsharp for Linux. Sorry, I installed a TON of stuff but I think that's the one that did it.

@koliyo
Copy link

koliyo commented Oct 1, 2019

I am getting this on Mac since upgrading to .NET Core 3.0

@raudabaugh
Copy link

Same here @koliyo .

@martinhorvath
Copy link

Just for the sake of completeness... I had the same issue on Debian 10 and Omnisharp uses the mono environment installed. After upgrading mono-devel to 6.14 using the standard installation procedure, the error was resolved.

@Ghostbird
Copy link

Ghostbird commented Nov 5, 2019

Just for the sake of completeness... I had the same issue on Debian 10 and Omnisharp uses the mono environment installed. After upgrading mono-devel to 6.14 using the standard installation procedure, the error was resolved.

I ran in to this too, but what do you mean by the standard installation procedure? The standard apt install mono-devel will install Mono 5.18 which is the latest that is standard available for Debian 10.
When using the special instructions from https://mono-project.com, I receive Mono 6.4, which is the latest version they offer for Debian 10.

Neither of which solves the problem.

Nevermind, I must have done something wrong. A reinstall of mono-devel 6.4 after adding the https://mono-project.com repositories did take a lot longer and LLVM was used to compile a lot of Mono 4.5 libraries (Why? I have no clue.) but afterwards everything worked again.

Still this is strange, as I have never before had to install mono-devel, as the version that comes with the C# extension for Visual Studio Code normally worked fine.

@laredoza
Copy link

I upgraded to Linux Mint 20 and had a similar issue. Tried reinstalling just about everything dotnet related but the only thing that worked for me was apt install mono-devel

@breadnone
Copy link

This happened again after todays update... sighs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests