Build Application with Mono C# Compiler

I am working on porting an existing Unity application to HoloLens. There was a massive amount of script compilation errors if I set the Target Platform to “Windows Store” and then build the application. Most of the errors came from the incompatible APIs between Mono and .NET Core. The errors are removed if I set “Compilation Overrides” to “None” which force the application to use the Mono C# compiler / library. (reference: https://docs.unity3d.com/Manual/windowsstore-faq.html)

However, although the Build succeeds and generates the VS .sln under the output folder, it’s still impossible to compile the solution in Visual Studio 2015. It seems VS2015 are still using .NET Core libraries when building the application, like the “Compilation Overrides” is not effective. (Microsoft.NETCore.UniversalWindowsPlatform and WinRTLegacy) is visible in the references of the generated projects)

My questions are: Does HoloLens application have to use the .NET Core compiler? How to get the application running in Window Store environment if it relies on APIs which only available in Mono but not .NET Core?

Thank you very much!

It’s possible to use .NET 3.5 API set if you switch to IL2CPP scripting backend. You’ll then have an identical API surface compared to other Unity platforms.

Don’t use compilation overrides to change APIs you can use. It only changes the compiler (as you said), but doesn’t change the available API surface. It was meant to use if you needed to reference your C# scripts from UnityScript, as it is unable to reference scripts compiled by Microsoft C# compiler.

1 Like

That would be absolutely awesome! Thank you!

However, when I choose “IL2CPP” as the scripting backend, I get “Currently selected scripting backend(IL2CPP) is not installed” in the “Build Settings” dialog. And I could not find the option to install IL2CPP in the installation dialog of Unity 5.4.0f3-HTP, only the “.NET Scripting Backend” was there. Do you know how could I install the IL2CPP backend properly?

Looks like the installer posted on this board is borked (there’s no IL2CPP option while there should be). Let me see if I can cook you a new IL2CPP scripting backend installer over night.

1 Like

I would really appreciate that. Thank you so much :slight_smile:

It finished faster than I had expected:

https://oc.unity3d.com/index.php/s/BJq6tnDmh8XJFHt

Let me know if it works… I think the installer should match the latest HTP build, but just in case test it with empty project to make sure the thing works :).

The package works perfectly. I installed that upon the Unity HTP version and have used it to successfully generated a workable UWP application from an empty project with IL2CPP scripting backend.

When applying the IL2CPP to my project I also got the project generated and built successfully. Currently, there are a few errors in execution. But those errors are mismatching asset bundles (those were targeting another platform), which shall not have any relationship to the scripting backend. I’m going to fix them.

Thanks again for your quick help! :slight_smile:

I’m glad it worked out for you :).

@Tautvydas-Zilys ,

Would there be any way you could post another installer but for the non-hololens version? I happen to be running 5.4.0f3, but the non-hololens version. I am running into a similar issue, where I cannot seem to find a way to install the IL2CPP backend. I tried installing the hololens version you linked above to my Unity. It compiles but I get an error on the windows phone:

Invalid serialized file version. File: “C:/data/Programs/WindowsApps/mApp_0.0.4.0_arm__pcbna9mkpb3j0/Data/globalgamemanagers”. Expected version: 5.4.0f3-HTP. Actual version: 5.4.0f3.

Thank you

Yeah, don’t install non-matching versions :).

Here’s the link: http://beta.unity3d.com/download/a6d8d714de6f/TargetSupportInstaller/UnitySetup-UWP-IL2CPP-Support-for-Editor-5.4.0f3.exe

1 Like

I’m having similar problems in a project I’m working on.
I made this post about it.

When I try changing to IL2CPP I’m getting

I have tried both with Scripting Runtime Version 3.5 and 4.6 with the API compatibility level set to 4.6 and I have Compilation Overrides set to Use Net Core Partially.

Did you even read the error message? It tells you to build to an empty folder because the folder you selected is not empty.

I realized that after I posted. Sorry forgot to update this. Now I have it building in Unity and Visual Studio without errors, but when the project runs in Visual Studio I’m getting a black screen in the Windows MR headset and then it slows down before Visual Studio (or sometimes the whole system) crashes. I’m currently using 2017.2.0p2-MRTP.
This is the log from I’m getting from Visual Studio.

Hmm, the version is still outdated for Unity2017.2.x - Is there one for the more recent version as well? :smile:

Are you using Unity Download Assistant? It should download matching versions automatically.

1 Like