Skip to content

OmniSharp

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

C# 플러그인 설치 후 C# 파일을 열면 다음과 같은 에러가 발생될 수 있다.

 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

C# 플러그인의 Omnisharp: Use Global Mono 설정을 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).

omnisharp.useGlobalMono 설정을 always로 변경하자.

=== .NETFramework,Version=v4.7.2 were not found === 경고는 다음과 같다.

[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

참고로 ArchLinux에서 실행한 godot에서 다음과 같이 .csproj 파일이 생성되었다:

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

SDK 스타일 프로젝트의 대상 프레임워크 - .NET | Microsoft Docs 문서를 확인하고, .NET Core를 사용하도록 TargetFramework를 수정한다. (버전은 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 } } }

에러가 발생된 라인은 다음과 같다:

[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