Skip to content
Search

OmniSharp

lastmod 2025-02-14created 2020-11-1010 edits

OmniSharp is a family of Open Source projects, each with one goal: To enable a great .NET experience in YOUR editor of choice

Troubleshooting

.NETFramework not found in macOS

After installing the C# plugin, opening a C# file may produce the following error.

 Microsoft.Common.CurrentVersion.targets(1175, 5): [MSB3644] The reference assemblies for
 .NETFramework,Version=v4.7.1 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

Change the C# plugin's Omnisharp: Use Global Mono setting to always.

This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework)

/home/yourname/.vscode/extensions/ms-dotnettools.csharp-1.24.1/.omnisharp/1.38.1/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1220,5): Error: This project targets .NET version that requires reference assemblies that do not ship with OmniSharp out of the box (e.g. .NET Framework). The most common solution is to make sure Mono is installed on your machine (https://mono-project.com/download/) and that OmniSharp is started with that Mono installation (e.g. "omnisharp.useGlobalMono":"always" in C# Extension for VS Code).

Change the omnisharp.useGlobalMono setting to always.

=== .NETFramework,Version=v4.7.2 were not found === The warning is as follows.

[fail]: OmniSharp.MSBuild.ProjectLoader
        The reference assemblies for .NETFramework,Version=v4.7.2 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 '/home/yourname/Project/EduPiano/EduPiano.csproj'.
/home/yourname/Project/EduPiano/EduPiano.csproj
/home/yourname/.vscode-oss/extensions/ms-dotnettools.csharp-1.23.2/.omnisharp/1.37.1/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1178,5): Error: The reference assemblies for .NETFramework,Version=v4.7.2 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: /home/yourname/Project/EduPiano/EduPiano.csproj

For reference, godot running on ArchLinux generated the following .csproj file:

<Project Sdk="Godot.NET.Sdk/3.2.3">
  <PropertyGroup>
    <TargetFramework>net472</TargetFramework>
  </PropertyGroup>
</Project>

Check the Target frameworks in SDK-style projects - .NET | Microsoft Docs documentation and modify TargetFramework to use .NET Core. (Check the version with dotnet --version)

<Project Sdk="Godot.NET.Sdk/3.2.3">
  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>
</Project>

This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework)

Starting OmniSharp server at 4/5/2023, 3:02:14 PM
    Target: /home/yourname/Project/EduPiano/godot/EduPiano.sln

OmniSharp server started with .NET 6.0.407
.
    Path: /home/yourname/.vscode/extensions/ms-dotnettools.csharp-1.25.4-linux-x64/.omnisharp/1.39.4-net6.0/OmniSharp.dll
    PID: 168353

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on Unknown 0.0 (Unknown)
[info]: OmniSharp.Services.DotNetCliService
        Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
[info]: OmniSharp.Services.DotNetCliService
        Using the 'dotnet' on the PATH.
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: .NET Core SDK 6.0.407 17.3.2 - "/usr/share/dotnet/sdk/6.0.407/"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: .NET Core SDK 6.0.407 17.3.2 - "/usr/share/dotnet/sdk/6.0.407/"
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/yourname/Project/EduPiano/godot'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Did not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/yourname/Project/EduPiano/godot/EduPiano.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/yourname/Project/EduPiano/godot/EduPiano.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/yourname/Project/EduPiano/godot'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Did not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/yourname/Project/EduPiano/godot' on host 168131.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/yourname/Project/EduPiano/godot/EduPiano.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/home/yourname/Project/EduPiano/godot/EduPiano.csproj'.
/home/yourname/Project/EduPiano/godot/EduPiano.csproj
/usr/share/dotnet/sdk/6.0.407/Microsoft.Common.CurrentVersion.targets(1220,5): Error: This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /home/yourname/Project/EduPiano/godot/EduPiano.csproj
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
        Inlay hints requested for document not in workspace Location { FileName = /home/yourname/Project/EduPiano/godot/Scene/EPFactoryCollectionUI.cs, Range = Range { Start = Point { Line = 0, Column = 0 }, End = Point { Line = 95, Column = 0 } } }
[warn]: OmniSharp.Roslyn.CSharp.Services.InlayHints.InlayHintService
        Inlay hints requested for document not in workspace Location { FileName = /home/yourname/Project/EduPiano/godot/Scene/EPFactoryCollectionUI.cs, Range = Range { Start = Point { Line = 0, Column = 0 }, End = Point { Line = 95, Column = 0 } } }

The line where the error occurred is as follows:

[fail]: OmniSharp.MSBuild.ProjectLoader
        This project targets .NET version that requires reference assemblies that are not installed (e.g. .NET Framework). The most common solution is to make sure Mono is fully updated on your machine (https://mono-project.com/download/) and that you are running the .NET Framework build of OmniSharp (e.g. 'omnisharp.useModernNet': false in C# Extension for VS Code).

See also

Favorite site

author Zer0 sitemap