Table of Contents#
Understanding the Error#
The “.NETFramework 4.7.1 Reference Assemblies Not Found” error occurs because:
- Unity uses .NET Framework 4.7.1 (or earlier) for legacy scripting support.
- .NET Framework is a Windows-only runtime; Ubuntu/Linux does not ship with its reference assemblies (e.g.,
System.dll,mscorlib.dll). - VSCode’s C# extension (powered by OmniSharp) relies on these assemblies to provide IntelliSense, syntax highlighting, and error checking. Without them, OmniSharp cannot resolve .NET Framework types, leading to the error.
Prerequisites#
Before proceeding, ensure you have the following installed:
- Unity3D: Version 2018.1 or newer (supports .NET 4.x scripting runtime).
- VSCode: Installed via Ubuntu Software Center or
snap install code --classic. - VSCode C# Extension: Install from the VSCode Marketplace (
ms-dotnettools.csharp). - Terminal Access: To run commands (Ubuntu’s default terminal or Terminator).
Step-by-Step Fix#
Step 1: Install Mono (for .NET Framework Compatibility)#
Mono is an open-source implementation of .NET Framework, providing partial compatibility on Linux. It includes some reference assemblies, which Unity and VSCode can use.
Install Mono:
Open a terminal and run:
sudo apt update && sudo apt install mono-complete -ymono-completeinstalls all Mono components (runtime, compilers, and reference assemblies).
Verify Installation:
Check Mono version with:
mono --versionYou should see output like Mono JIT compiler version 6.8.0.105 (or newer).
Step 2: Configure Unity’s Scripting Settings#
Ensure Unity uses the .NET 4.x runtime, which aligns with the missing reference assemblies.
-
Open your Unity project.
-
Go to Edit > Project Settings > Player.
-
In the Other Settings tab (under “Configuration”):
- Scripting Runtime Version: Set to .NET 4.x Equivalent (not “.NET Standard 2.0”).
- Scripting Backend: Use Mono (IL2CPP is less compatible with Linux).
- Api Compatibility Level: Set to .NET Framework 4.x.

Fig 1: Unity’s Player Settings for .NET 4.x -
Click Apply to save changes. Unity will regenerate project files (
.csproj,.sln).
Step 3: Install .NETFramework 4.7.1 Reference Assemblies via NuGet#
Mono may not include all .NET 4.7.1 reference assemblies. To fill gaps, use NuGet (the .NET package manager) to install the official Microsoft reference assemblies.
Install NuGet CLI:
If you don’t have NuGet, install it via:
sudo apt install nuget -yDownload Reference Assemblies:
- Navigate to your Unity project’s root folder in the terminal. For example:
cd ~/UnityProjects/MyProject - Run the following NuGet command to install .NET 4.7.1 reference assemblies:
nuget install Microsoft.NETFramework.ReferenceAssemblies.net471 -OutputDirectory packages- This downloads the
Microsoft.NETFramework.ReferenceAssemblies.net471package (official Microsoft reference assemblies) into apackagesfolder in your project.
- This downloads the
Step 4: Update Project Configuration#
Unity generates .csproj (C# project) files, but these may not reference the NuGet-installed assemblies. We’ll manually update the configuration to point to the new assemblies.
Option A: Update the .csproj File#
-
In your Unity project, navigate to the
Libraryfolder (hidden by default; enable “Show Hidden Files” in your file manager). -
Locate your project’s
.csprojfile (e.g.,MyProject.csprojorAssembly-CSharp.csproj). -
Open the
.csprojfile in VSCode. -
Add the following
<ItemGroup>section before the closing</Project>tag:<ItemGroup> <!-- Reference assemblies from NuGet package --> <Reference Include="*"> <HintPath>../packages/Microsoft.NETFramework.ReferenceAssemblies.net471/ref/net471/*.dll</HintPath> </Reference> </ItemGroup>- This tells MSBuild (used by OmniSharp) to load all
.dllreference assemblies from the NuGet package.
Note: If Unity regenerates the
.csprojfile (e.g., after adding scripts), you may need to re-add this section. - This tells MSBuild (used by OmniSharp) to load all
Option B: Configure OmniSharp (Alternative to Editing .csproj)#
If editing .csproj is cumbersome, configure OmniSharp (VSCode’s C# backend) to use the NuGet assemblies directly:
- In your Unity project, create a
.vscodefolder (if it doesn’t exist):mkdir -p ~/UnityProjects/MyProject/.vscode - Create an
omnisharp.jsonfile in.vscode:nano ~/UnityProjects/MyProject/.vscode/omnisharp.json - Add the following content and save (Ctrl+O, Enter, Ctrl+X):
{ "msbuild": { "referenceAssembliesPath": "./packages/Microsoft.NETFramework.ReferenceAssemblies.net471/ref/net471/" } }- This tells OmniSharp to look for reference assemblies in the NuGet package folder.
Step 5: Verify and Restart Tools#
- Restart VSCode: Close and reopen VSCode to reload OmniSharp.
- Check OmniSharp Log:
- Open VSCode’s Output panel (Ctrl+Shift+U).
- Select “OmniSharp Log” from the dropdown.
- Look for messages like
Successfully loaded projectorReference assemblies loaded. If you see errors about missing assemblies, double-check theomnisharp.jsonpath or.csprojedits.
- Test IntelliSense: Open a C# script in VSCode (e.g.,
PlayerController.cs). Typeusing System;—IntelliSense should resolveSystemwithout errors.
Alternative Solutions#
Alternative 1: Copy Assemblies from a Windows Machine#
If NuGet fails, copy .NET 4.7.1 reference assemblies from a Windows PC:
- On Windows, navigate to:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.7.1 - Copy the entire
v4.7.1folder to your Ubuntu machine (e.g., via USB or cloud storage). - Place it in
~/UnityProjects/MyProject/packages/(or any path). - Update
.csprojoromnisharp.jsonto point to this folder (e.g.,<HintPath>../packages/v4.7.1/*.dll</HintPath>).
Alternative 2: Use .NET 5+ (Modern Approach)#
If your project allows, migrate to .NET 5+ (cross-platform) instead of .NET Framework:
- In Unity’s Player Settings, set Api Compatibility Level to .NET Standard 2.1 or .NET 5+.
- Update scripts to use .NET 5+ APIs (most .NET Framework code is compatible).
- This avoids reliance on Windows-only reference assemblies.
Conclusion#
The “.NETFramework 4.7.1 Reference Assemblies Not Found” error in Unity3D on Ubuntu is caused by missing Windows-only .NET Framework assemblies. By combining Mono for base compatibility, NuGet for official reference assemblies, and configuration tweaks, you can resolve the error and restore VSCode’s IntelliSense.
For long-term projects, consider migrating to .NET 5+ for cross-platform support. For legacy projects, the NuGet + OmniSharp fix outlined above is reliable.