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

The reference assemblies for .NETFramework,Version=v5.0 were not found when using global Mono #4123

Closed
AybarsAcar opened this issue Oct 20, 2020 · 8 comments

Comments

@AybarsAcar
Copy link

Hi Omnisharp team,

I have been developing a web api using dotnet 5. and when I launched the vscode this morning I realised the Intellisense stopped working even though I haven't had any issues last night.
I haven't made any changes since then

Here is the log I get from Omnisharp

Starting OmniSharp server at 10/20/2020, 6:56:50 PM
    Target: /Users/aybarsacar/Desktop/cs/DatingApp/DatingApp.sln

OmniSharp server started with Mono 6.12.0.
    Path: /Users/aybarsacar/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/OmniSharp.exe
    PID: 1586

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.15.7 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 2 MSBuild instance(s)
            1: Mono 16.8.0 - "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin"
            2: StandAlone 16.8.0 - "/Users/aybarsacar/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: Mono 16.8.0 - "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin"
            CscToolExe = csc.exe
            CscToolPath = /Users/aybarsacar/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/Roslyn
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/aybarsacar/Desktop/cs/DatingApp'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/Users/aybarsacar/Desktop/cs/DatingApp/DatingApp.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/aybarsacar/Desktop/cs/DatingApp/API/API.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/aybarsacar/Desktop/cs/DatingApp'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/aybarsacar/Desktop/cs/DatingApp/API/API.csproj
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/Users/aybarsacar/Desktop/cs/DatingApp' on host 1566.
[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/aybarsacar/Desktop/cs/DatingApp/API/API.csproj'.
/Users/aybarsacar/Desktop/cs/DatingApp/API/API.csproj
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1193,5): Error: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/aybarsacar/Desktop/cs/DatingApp/API/API.csproj

here is my dotnet info:

.NET SDK (reflecting any global.json):
 Version:   5.0.100-rc.2.20479.15
 Commit:    da7dfa8840

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.15
 OS Platform: Darwin
 RID:         osx.10.15-x64
 Base Path:   /usr/local/share/dotnet/sdk/5.0.100-rc.2.20479.15/

Host (useful for support):
  Version: 5.0.0-rc.2.20475.5
  Commit:  c5a3f49c88

.NET SDKs installed:
  3.1.402 [/usr/local/share/dotnet/sdk]
  5.0.100-rc.2.20479.15 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.22 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.0-rc.2.20475.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

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

and my csproj file

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.0-rc.2.20475.6"/>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0-rc.2.20475.6"/>
    <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.7.1"/>
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.0-rc.2.20475.17"/>
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0"/>
    <PackageReference Include="CloudinaryDotNet" Version="1.11.0"/>
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.0-rc.2.20475.17"/>
  </ItemGroup>
</Project>

cheers!

Aybars

@AybarsAcar
Copy link
Author

Hey guys!

I have solved the issue by disabling the autoupdates on vscode and installing the previous version of the C# extension for Vscode.
So, I assume there might an issue with the current version of the extension

cheers!

Aybars

@filipw filipw changed the title Omnisharp is not working C# extension for vscode The reference assemblies for .NETFramework,Version=v5.0 were not found when using global Mono Oct 20, 2020
@filipw
Copy link
Contributor

filipw commented Oct 20, 2020

If you run into this issue please post the output of your mono -V command.
If it is lower than Mono JIT compiler version 6.12.0.90, then make sure to download latest stable from here https://www.mono-project.com/download/stable/

Older Mono cannot handle .NET 5.0 RC2.

You can also tell OmniSharp to stop using global Mono by setting "omnisharp.useGlobalMono": "never" in the VS Code settings and restarting VS Code.

edit: we are still waiting for the updated Mono release here mono/mono#20250

@steveoh
Copy link
Contributor

steveoh commented Oct 20, 2020

Should the homebrew mono work?

/usr/local/Cellar/mono/6.12.0.90/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(1191,5): Error: The reference assemblies for framework ".NETFramework,Version=v5.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

@breiter
Copy link

breiter commented Oct 20, 2020

I'm having this same problem with the latest stable mono from the official package and the C# extension version 1.23.4 for VSCode and dotnet core 3.1 stable.

There are differences in the embedded version of mono 16.12.0.90. The msbuild version bundled in omnisharp is 16.8.0-preview-20475-05+aed5e7ed0.

Global mono

$ mono --version
Mono JIT compiler version 6.12.0.90 (2020-02/d3daacdaa80 Thu Jul 30 16:18:06 EDT 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(610)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)
$ msbuild -version
Microsoft (R) Build Engine version 16.6.0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

16.6.0.38001
 $ /Users/breiter/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/bin/mono --version
Mono JIT compiler version 6.12.0.90 (2020-02/d3daacdaa80 Thu Jul 30 16:18:06 EDT 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(610)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)

$ find /Users/breiter/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/ -iname msbuild.dll
/Users/breiter/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.dll
/Users/breiter/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/15.0/Bin/MSBuild.dll
$ mono /Users/breiter/.vscode/extensions/ms-dotnettools.csharp-1.23.4/.omnisharp/1.37.3/omnisharp/.msbuild/Current/Bin/MSBuild.dll -version
Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.

16.8.0.47505

Uninstalling the global mono or setting the UseGlobalMono option for vscode in settings.json to "never" resolves the problem.

{    
  "omnisharp.useGlobalMono": "never"
}

@AybarsAcar
Copy link
Author

Thank you the issue is solved, thank you for the solutions @filipw and @breiter

@Nessitro
Copy link

Updating Visual Studio Community 2019 to latest version (16.8.6) fixed this vscode problem for me

@SkymanOne
Copy link

{    
  "omnisharp.useGlobalMono": "never"
}

did not help me, I still get the same error.
Any ideas what to do?

@yura-kinoo
Copy link

{    
  "omnisharp.useGlobalMono": "never"
}

did not help me, I still get the same error.
Any ideas what to do?

What did solve the problem for me is me installing a Preview version of Visual Studio, which had an update for the Mono SDK. Then I set the "omnisharp.useGlobalMono" to "always" and it started working again.

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

7 participants