Predefined type 'System.Object' is not defined or imported

Tried to follow the Microsoft Hololense Tutorial but always get 10k-20k Errors where it says:
“xx” is not defined or imported
or
The type ‘Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’

For examples check the Box.
Can someone help me?

(Copy paste, using Visual Studio in german so the output is german too)

Schweregrad    Code    Beschreibung    Projekt    Datei    Zeile    Unterdrückungszustand
Fehler    CS0012    Der Typ "ValueType" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    137    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.ValueType" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    137    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.Object" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    137    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.Void" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    137    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.ValueType" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    139    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.Object" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    139    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.Void" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    139    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.Single" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    141    Aktiv
Fehler    CS0518    Der vordefinierte Typ "System.Void" ist nicht definiert oder importiert.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\LineManager.cs    141    Aktiv
Fehler    CS0234    Der Typ- oder Namespacename "Generic" ist im Namespace "System.Collections" nicht vorhanden. (Möglicherweise fehlt ein Assemblyverweis.)    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\MeasureManager.cs    7    Aktiv
Fehler    CS0012    Der Typ "Object" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" hinzu.    Assembly-CSharp    C:\DevProjects\MRBeans\Assets\HoloToolkit-Examples\GazeRuler\Scripts\MeasureManager.cs    18    Aktiv
1 Like

Hi, try putting this at the top of your .cs file:

using System;

I had it there, but VS didn’t used it. Needed to disable and reenable the Nuget packeges, so it whould (re)download it, then it worked.

1 Like

Could you outline what exactly you did when you “disable and reenable the Nuget packeges”? Having the same issue and everything that I thought could be meant by that did not help :confused:

3 Likes

I am facing the same problem, hope you had elaborated on how to disable and re-enable nuget packages :confused:

I used the visual studio installer to do a full repair. It will ask you to do a full restart upon completion. The errors went away after the restart.

Here’s a link that I found useful: Install & configure Visual Studio Tools for Unity | Microsoft Learn