Mixedrealitytoolkit-unity: .nuget\packages\Microsoft.CSharp\4.0.1 directory not found

Created on 13 Jun 2018  路  5Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Overview

Upon importing MRT in 2017.4.5f1 LTS I am returned the following:

System.Exception: Package directory not found: "....nugetpackagesMicrosoft.CSharp4.0.1".

Expected Behavior

No console errors returned

Actual Behavior

console error returned

Unity Editor Version

2017.4.5f1

Mixed Reality Toolkit Release Version

2017.4.0.0

Most helpful comment

Fix: Just install the package in Visual Studio using Package Manager Console.

PM> Install-Package Microsoft.CSharp -Version 4.0.1

All 5 comments

This happens because of an issue with Unity's API updater process.

When you open a project Unity runs the API updater on your source and on all the DLLs and if needed applies automatic "fixes" to them. It seems for each DLL it processes it assumes you have all the dependencies already downloaded in your nuget cache, but doesn't retrieve them if not.

The full error I was seeing was:
Error: System.Exception: Package directory not found:
"C:Users\[username]\.nugetpackagesMicrosoft.CSharp4.0.1".
at UnityEditor.Scripting.Compilers.NuGetPackageResolver.Resolve () [0x000dd]

I reported this to Unity and they pointed me at this year old known issue:
https://issuetracker.unity3d.com/issues/dot-netcore-5-uwp-dll-throws-exception-when-api-updater-runs

Maybe one day they will fix it... for now its non-fatal, just annoying.

We were having this problem on our build servers and the error was failing our builds. If that is your case you can use the command line parameter -disable-assembly-updater https://docs.unity3d.com/Manual/CommandLineArguments.html

Fix: Just install the package in Visual Studio using Package Manager Console.

PM> Install-Package Microsoft.CSharp -Version 4.0.1

@rperreta I have tried to install the package as you mentioned

Install-Package : Could not install package 'Microsoft.CSharp 4.0.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v3.5,Profile=Unity Subset v3.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

My settings are similar to yours.

If I ignore the error message and continue with the tutorial at https://docs.microsoft.com/en-us/windows/mixed-reality/holograms-210 and try to run the scene by pressing the play button, it shows some other compiler error. I managed to solve them by adding an input manager and basic cursor. However, the play button do not show the scene. It only show a black screen. Any comments on that?

@reillydonovan did you able to solve the problem?

Bulk closing older HTK bug. Please reopen if you can repro this issue in MRTK v2.

Thanks!
Yoyo

This error also won't affect build

Was this page helpful?
0 / 5 - 0 ratings