Cannot run build project MRTK 2 RC 1 or RC 2
Describe the bug
Cannot build the generated Visual Studio project. Unity gives no (unexpected) errors, but when building the project using the .NET scripting backend it gives an exception:
1> Failed to fix references for method System.Collections.Generic.List`1<System.Type> Microsoft.MixedReality.Toolkit.Utilities.AwaiterExtensions/CoroutineWrapper`1::GenerateObjectTrace(System.Collections.Generic.IEnumerable`1<System.Collections.IEnumerator>)
1> Failed to fix references for type Microsoft.MixedReality.Toolkit.Utilities.AwaiterExtensions/CoroutineWrapper`1
1> System.Exception: Failed to resolve System.Reflection.BindingFlags
1> at Unity.ModuleContext.Retarget(TypeReference type, GenericContext context)
1> at Unity.ModuleContext.Retarget(MethodReference method, GenericContext context)
1> at Unity.FixReferencesStep.Visit(MethodDefinition method, GenericContext context)
1> at Unity.FixReferencesStep.Visit(TypeDefinition type)
1> at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
1> at Unity.TypeDefinitionDispatcher.DispatchType(TypeDefinition type)
1> at Unity.TypeDefinitionDispatcher..ctor(ModuleDefinition module, ITypeDefinitionVisitor visitor)
1> at Unity.FixReferencesStep.ProcessModule()
1> at Unity.ModuleStep.Execute()
1> at Unity.FixReferencesStep.Execute()
1> at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext)
1> at Unity.Operation.Execute()
1> at Unity.Program.Main(String[] args)
To reproduce
Steps to reproduce the behavior:
- Make a new project in the Unity 2018 LTS
- Add MRTK Foundation and Examples from RC1
- Change Scripting backend to .NET
- Build the project, it will build successfully
- Open the project in Visual Studio 2017
- Select Debug and x86
- Build the project
- This is where the error will occur
Expected behavior
I expect the project to build.
Screenshots
If applicable, add screenshots to help explain your problem.
Your Setup (please complete the following information)
- Unity Version 2018.4.2f1 and Unity Version 2018.4.1f1
- MRTK Version 2.0 RC 1
Target Platform (please complete the following information)
- HoloLens
- HoloLens 2
Can you retest with the latest RC 2 (released ysterday) please
I retested, and have the same problem on the empty project with just the Foundation and Examples on RC2.
Same issue, Hololens 1
Does this also happen if you have C# projects enabled?
See this: https://forum.unity.com/threads/error-while-building-uwp-app-with-min-platform-version-10-0-16299-0.685918/
Easiest workaround is to target Windows version 15063 as min version (instead of 16299 or higher). Another workaround involves editing the project file by hand.
I'm following up with .NET folks at Microsoft to see if they can fix it on their end. If not, I'll change the project generation on Unity side to include the workaround I posted in the thread.
See this: https://forum.unity.com/threads/error-while-building-uwp-app-with-min-platform-version-10-0-16299-0.685918/
Easiest workaround is to target Windows version 15063 as min version (instead of 16299 or higher). Another workaround involves editing the project file by hand.
I'm following up with .NET folks at Microsoft to see if they can fix it on their end. If not, I'll change the project generation on Unity side to include the workaround I posted in the thread.
Hi, I'm running into this issue as well and I'm wondering if there's any updates on this as it is slowing down our iteration workflow by quite a lot.
I do have something that works. I put it as an answer here: https://stackoverflow.com/questions/56575926/running-mrtk2-project-gives-failed-to-resolve-system-reflection-bindingflags After this, it all runs fine. Only need to do this to the project file when you're making a new build. Building on top of an existing build doesn't change this project file.