Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VSCode Unity OmniSharp .NETFramework not found

I get this message in the output of VSCode

[fail]: OmniSharp.MSBuild.ProjectLoader
 The reference assemblies for framework ".NETFramework,Version=v4.7.1" 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.

this is what my dotnet output looks like

~ dotnet --info                                    
.NET Core SDK (reflecting any global.json):
 Version:   2.2.106
 Commit:    aa79b139a8

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.14
 OS Platform: Darwin
 RID:         osx.10.14-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.2.106/

Host (useful for support):
  Version: 2.2.4
  Commit:  f95848e524

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

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

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

With this error I can't get any IDE features for C# in VSCode.

like image 271
antpaw Avatar asked May 13 '19 19:05

antpaw


People also ask

Does Unity work with .NET 6?

NET Framework, because before Unity 2017.1, Unity has been using a . NET 3.5 equivalent scripting runtime, missing years of updates. With the release of Unity 2017.1, Unity introduced an experimental version of its scripting runtime upgraded to a . NET 4.6, C# 6.0 compatible version.

What is Omnisharp in Vscode?

OmniSharp is a set of tooling, editor integrations and libraries that together create an ecosystem that allows you to have a great programming experience no matter what your editor and operating system of choice may be.

Does Visual Studio use Omnisharp?

C# for Visual Studio Code (powered by OmniSharp) This extension provides the following features inside VS Code: Lightweight development tools for . NET Core.


2 Answers

  • Close VS Code.

  • Download and install Microsoft .NET Framework 4.7.1.

  • Download and install Microsoft's .NET Framework SDK any version with start 4.X

  • In VS Code, open Assembly_CSharp.csproj file and change TargetFrameworkVersion to what you installed .NET Framework SDK version.

You should have both .NET framework and targeting sdk installed for a particular version.

This is a temporary solution because targetFrameworkVersion always changes to unity defaults when you close the editor

like image 128
amirali Avatar answered Oct 19 '22 23:10

amirali


Install latest stable Mono Version should fix the issue for this one, if anyone faces a similar issue.

Or try a different one until it is resolved, might be some mono versions preventing this.

like image 35
vsarunov Avatar answered Oct 19 '22 23:10

vsarunov