MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Cannot run build project MRTK 2 RC 1 or RC 2

Open HedwigAR opened this issue 7 years ago • 7 comments

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:

  1. Make a new project in the Unity 2018 LTS
  2. Add MRTK Foundation and Examples from RC1
  3. Change Scripting backend to .NET
  4. Build the project, it will build successfully
  5. Open the project in Visual Studio 2017
  6. Select Debug and x86
  7. Build the project
  8. 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

HedwigAR avatar Jun 13 '19 14:06 HedwigAR

Can you retest with the latest RC 2 (released ysterday) please

SimonDarksideJ avatar Jun 13 '19 14:06 SimonDarksideJ

I retested, and have the same problem on the empty project with just the Foundation and Examples on RC2.

HedwigAR avatar Jun 13 '19 14:06 HedwigAR

Same issue, Hololens 1

IsaacSurfraz avatar Jun 13 '19 14:06 IsaacSurfraz

Does this also happen if you have C# projects enabled?

wiwei avatar Jun 13 '19 16:06 wiwei

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.

TautvydasZilys avatar Jun 17 '19 05:06 TautvydasZilys

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.

Pycorax avatar Jul 19 '19 10:07 Pycorax

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.

HedwigAR avatar Jul 19 '19 11:07 HedwigAR