Search Unity

[VS Code] Error: The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not foun

Discussion in 'Code Editors & IDEs' started by BenoitFreslon, Jul 7, 2019.

  1. BenoitFreslon

    BenoitFreslon

    Joined:
    Jan 16, 2013
    Posts:
    166
    Hello,

    I want to use VS Code Mac. I just followed the installation tutorial but I got this issue with Unity 2018.3.14f1 and VS Code 1.36

    Code (CSharp):
    1. Microsoft.Common.CurrentVersion.targets(1195,5): Error: 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.
     
  2. liviu_vasut

    liviu_vasut

    Joined:
    Oct 2, 2019
    Posts:
    2
    Same problem with Unity 2019.1.0f2 on Linux (Fedora) and VS Code 1.38. Any tips? Where should we look?
    I'm new to the C# ecosystem so I might interpret this the wrong way. I have installed dotnet-sdk-3.0, which is the latest version on their site (https://dotnet.microsoft.com/download). The error message also mentions .NETFramework but the download page does not have it for Linux, or Mac for that matter.
    Apart from that error, auto-completion doesn't work for Unity related classes, might be for the same reason.
     
  3. liviu_vasut

    liviu_vasut

    Joined:
    Oct 2, 2019
    Posts:
    2
    I managed to fix it by installing mono. See this comment https://forum.unity.com/threads/setup-visual-studio-code-on-linux.695509/#post-4944119
    The project still failed, but with another error:
    Code (CSharp):
    1. Unable to create directory "/Debug/". Access to the path "/Debug/" is denied
    I could not figure where this path was defined but I assumed that it actually tries to write in the root of the filesystem. So I manually created /Debug and did a chmod a+rw on it. Now everything works fine.
     
    Satscape likes this.
  4. batbaatp

    batbaatp

    Joined:
    Mar 27, 2017
    Posts:
    2
    Did you install Mono framework and .net core, if so write on your terminal below:
    export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/Current
     
  5. SpookyBre

    SpookyBre

    Joined:
    Sep 12, 2019
    Posts:
    1
  6. herdek550

    herdek550

    Joined:
    Feb 22, 2021
    Posts:
    1

    Thank you very much, after 4 hours of troubleshooting...
    All I had to do was uninstalling .NET 5, uninstalling SDK/Targeting Pack and installing .NET 4.7.1
    Finally intellisense works and I can start programming in Unity.

    For others googling this issue I add "tags" bellow:
    Windows 10, Visual studio code, Unity
    The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found.
    Intellisense (autocomplete) fix
     
  7. viseztrance

    viseztrance

    Joined:
    Feb 7, 2019
    Posts:
    15
    I had the same issue using csharp-ls in emacs on linux.
    Settings the env variable `export FrameworkPathOverride=/lib/mono/4.5`, fixed things for me.