vscode-csharp: Error: The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found

Environment data

dotnet --info output: 2.2.1 VS Code version: C# Extension version: 1.17.1

Steps to reproduce

Try to use the Unity Debugger. Error gets thrown in VSCode

Expected behavior

No errors

Actual behavior

Errors on startup

The .NETFramework is not available on a Mac. I’m not sure if it is needed for this extension - if it is, the extension is useless on Mac. If it is not, there should be a check for the platform or something. Regardless, if I try to debug Unity, it crashes as soon as I hit play (Debug adapter process has terminated unexpectedly (spawn mono ENOENT)

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

Try adding export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current to your ~/.bash_profile or ~/.zshrc or whichever terminal you use. Restart VSCode before trying again.

Try adding export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current to your ~/.bash_profile or ~/.zshrc or whichever terminal you use. Restart VSCode before trying again.

That worked for me too! Thank you very much!

can you share the OmniSharp Log from the project you are working on?

Same issue =\

https://github.com/OmniSharp/omnisharp-vscode/issues/3063#issuecomment-642598877

Starting OmniSharp server at 6/11/2020, 3:26:22 PM
    Target: /Users/dtx/Dev/_unity/myProject/MyProject/MyProject.sln

OmniSharp server started.
    Path: /Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/run
    PID: 575

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on MacOS 10.14.6 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.4 - "/Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.4 - "/Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin
            CscToolPath = /Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/Users/dtx/Dev/_unity/myProject/MyProject'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/Users/dtx/Dev/_unity/myProject/MyProject/MyProject.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp-Editor.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/Users/dtx/Dev/_unity/myProject/MyProject'.
[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/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp.csproj
[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/dtx/Dev/_unity/myProject/MyProject' on host 558.
[fail]: OmniSharp.MSBuild.ProjectLoader
        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
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp.csproj'.
/Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp.csproj
/Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1193,5): Error: 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

[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp-Editor.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        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
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file '/Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp-Editor.csproj'.
/Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp-Editor.csproj
/Users/dtx/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1193,5): Error: 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

[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp.csproj
[fail]: OmniSharp.MSBuild.ProjectManager
        Attempted to update project that is not loaded: /Users/dtx/Dev/_unity/myProject/MyProject/Assembly-CSharp-Editor.csproj

@heaversm You need to install mono (https://www.mono-project.com/download/stable/#download-mac). I recommend installing version 5.18 from that page instead of using homebrew/etc package managers. (copied from https://github.com/OmniSharp/omnisharp-vscode/issues/2555#issuecomment-456998688)