Omnisharp-vscode: Omnisharp can not find assembly netstandard

Created on 17 Apr 2019  路  25Comments  路  Source: OmniSharp/omnisharp-vscode

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:a1ssrcOmniSharp.HostHostHelpers.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:Usersmoserk.vscodeextensionsms-vscode.csharp-1.18.0.omnisharp3.5.0-beta.2219OmniSharp.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:a1ssrcOmniSharp.HostHostHelpers.cs:line 29

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLMSoftwareMicrosoftFusion!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 [HKLMSoftwareMicrosoftFusion!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 Filesdotnetsdk2.2.203

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

.NET Core SDKs installed:
2.1.4 [C:Program Filesdotnetsdk]
2.1.103 [C:Program Filesdotnetsdk]
2.1.201 [C:Program Filesdotnetsdk]
2.1.202 [C:Program Filesdotnetsdk]
2.1.400 [C:Program Filesdotnetsdk]
2.1.403 [C:Program Filesdotnetsdk]
2.1.502 [C:Program Filesdotnetsdk]
2.1.505 [C:Program Filesdotnetsdk]
2.2.203 [C:Program Filesdotnetsdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.4 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.6 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.4 [C:Program FilesdotnetsharedMicrosoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.5 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:Program FilesdotnetsharedMicrosoft.NETCore.App]
Microsoft.NETCore.App 2.2.4 [C:Program FilesdotnetsharedMicrosoft.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|;

Most helpful comment

I have the same issue, but on linux

All 25 comments

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

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

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

It appears I have 4.7.2 installed...

C:WindowsMicrosoft.NETFrameworkv4.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

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.

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.

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 (https://github.com/OmniSharp/omnisharp-roslyn/pull/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.

@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.

@filipw - I still have that in my settings:

"omnisharp.path": "latest"

Should it be set to something else?

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 https://github.com/OmniSharp/omnisharp-roslyn/issues/1416#issuecomment-484415857
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.

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

Same issue, resolved disabling update and installing 1.18.0

This was resolved by https://github.com/OmniSharp/omnisharp-roslyn/pull/1469
Until the next release, the workaround is to install .NET 4.7.2 or use the method described here https://github.com/OmniSharp/omnisharp-vscode/issues/3004#issuecomment-484655065 which will prompt automatically for .NET 4.7.2 installation.

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

@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 https://github.com/OmniSharp/omnisharp-roslyn/pull/1469

I have the same issue, but on linux

Ditto for Linux.

```Starting OmniSharp server at 7/18/2019, 10:14:41 AM

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.b__0 () [0x0000b] in :0
at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute (System.String[] args) [0x00039] in <344a1e8cd6594b17b1e01f8df6ae8827>:0
at OmniSharp.CommandLineApplication.Execute (System.Collections.Generic.IEnumerable1[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.Func1[TResult] action) [0x0001c] in :0
[ERROR] Error: OmniSharp server load timed out. Use the 'omnisharp.projectLoadTimeout' setting to override the default delay (one minute).
```

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.

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

Same here @koliyo .

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.

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.

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

This happened again after todays update... sighs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jrmcdona picture jrmcdona  路  3Comments

gregg-miskelly picture gregg-miskelly  路  3Comments

yufeih picture yufeih  路  3Comments

visten picture visten  路  4Comments

tstivers1990 picture tstivers1990  路  3Comments