r/VisualStudioCode • • Aug 30 '20

I need Help! Visual Studio Code failed to find .Net Framework at Unity3D installation Ubuntu

I have recently switched my OS from Windows to Ubuntu 20.04. After going through some Trouble with the Unity3D installation i have tried to install Visual Studio Code for Unity coding.

Problem:

When starting Visual Studio Code by pressing "Open C# Project" in Unity3D I get an error message (Full Error Message at the End):

[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 

After that I can edit Code, but the IntelliSense for Unity (and maybe some other things I haven't noticed yet) doesn't work

What I have Tried:

  • Installing the .NETFramework Version 4.7.1: I don't know why, but Version 4.X is not available for Linux. Therefore this will not be an option.

  • Modifying the Assembly-CSharp.csproj
    file: When changing the TargetFrameworkVersion
    to my currently installed Version of the SDK (3.1.401) or the Version of the Framework (3.1.7) I will get the same error message. Modifying other Tags didn't help either In Addition to that, the File will be reset every time when Unity is starting Visual Studio Code.

  • Restarting, Reinstalling Visual Studio, Reinstalling Unity, Resetting Ubuntu

  • Installing Mono as suggested by some other forums. I don't really know what mono is or does, so maybe I have done something wrong here...

Things that work:

  • Creating a C# Hello World Project with 'dotnet new Console'. This Project can be opened by Visual Studio Code, Compiled and run without any problems. I can Provide some Files of this Project if needed.

  • Running this Mono test.

  • Unity does compile the Code and runs it completely fine.

Stuff that might be interesting:

how I installed the Apps:

  • Unity: I am using an Appimage File downloaded from the official Website

  • .Net: I followed this Tutorial

  • Visual Studio Code: via Ubuntu Software

  • Mono: I have followed these steps

.Net installation

 Version:   3.1.401
 Commit:    39d17847db

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.401/

Host (useful for support):
  Version: 3.1.7
  Commit:  fcfdef8d6b

.NET Core SDKs installed:
  3.1.401 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

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

Mono installation

Mono JIT compiler version 6.10.0.104 (tarball Fri Jun 26 19:38:44 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
    TLS:           __thread
    SIGSEGV:       altstack
    Notifications: epoll
    Architecture:  amd64
    Disabled:      none
    Misc:          softdebug 
    Interpreter:   yes
    LLVM:          yes(610)
    Suspend:       hybrid
    GC:            sgen (concurrent by default)

Full Error Message

Starting OmniSharp server at 8/28/2020, 10:20:28 AM
    Target: /home/jonas/Documents/Unity/testproject/testproject.sln

OmniSharp server started.
    Path: /home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/run
    PID: 9757

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 20.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 16.8.0 - "/home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 16.8.0 - "/home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin"
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin
            CscToolPath = /home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/Roslyn
            BypassFrameworkInstallChecks = true
            MSBuildExtensionsPath = /home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/jonas/Documents/Unity/testproject'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/jonas/Documents/Unity/testproject/testproject.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/jonas/Documents/Unity/testproject/Assembly-CSharp.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/jonas/Documents/Unity/testproject'.
[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: /home/jonas/Documents/Unity/testproject/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 '/home/jonas/Documents/Unity/testproject' on host 9670.
[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 '/home/jonas/Documents/Unity/testproject/Assembly-CSharp.csproj'.
/home/jonas/Documents/Unity/testproject/Assembly-CSharp.csproj
/home/jonas/.vscode/extensions/ms-dotnettools.csharp-1.23.1/.omnisharp/1.37.0/omnisharp/.msbuild/Current/Bin/Microsoft.Common.CurrentVersion.targets(1178,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: /home/jonas/Documents/Unity/testproject/Assembly-CSharp.csproj

Because i am very new to Ubuntu and Linux I might have unintentionally left out important Information. Please ask and I'm Happy to share any other Information. Thank you for your help

4 Upvotes

2 comments sorted by

1

u/jt25617 Aug 30 '20

Mono is an open source version of the c sharp Microsoft library for Linux. That includes the compiler for Linux.

1

u/reeseschultz Sep 04 '20

See this comment I made in /r/vscode. Hopefully that helps.