NowSo I needed to create a Hololens 2 App and deploy it to an actual Hololens 2 that I had with me for development, AND I needed to save a copy of the compiled app that could be copied onto a Hololens 2 that my client had in another office. It was a very convoluted process so I thought I would document it now so I wouldn’t forget it for next time round.
Before you start make sure you have the following
Unity 2019.4.4f1
MRTK 2.4.0
Visual Studio 2019
The Best Tutorial on Set Up
I could go through and tell you how to create a Unity file that will run on the Hololens2, but really, just follow this one that Microsoft put out. It is the best.
https://docs.microsoft.com/en-us/windows/mixed-reality/develop/unity/tutorials/mr-learning-base-01
Just go through that page and you have set up your basic Unity MRTK file that compiles to the Hololens 2 through Visual Studio.
HOW TO CREATE A FILE TO SEND TO SOMEONE TO INSTALL
This is where is gets fiddly and you need to set up certificates and stuff. So…. let’s get started
In Unity, open your Player Settings File > Build Settings > Player Settings.
In the Player Settings Window Expand the Publishing Settings
Scroll down to the Certificate section and click the Create… button
A pop up box will appear and ask you to fill in a Publisher (I usually put in either my client name or my Sole trader name), and a password. Do this and then click Create
Now go back to Visual Studio and in the Solution Explorer window expand your app and locate the Package.appxmanifest file. Click on it to open it.
Click on the Packaging heading and then click on the Choose Certificate button
Click on the Select from file… button
Navigate to the Project Assets folder (make sure it’s not the Builds Asset folder!) and select the WSATestCertificate.pfx file
Now remember in Unity we gave the certificate a password, you’ll need to enter that now and press OK
Now click on View Full Certificate
And click on Install Certificate
Choose the Current User radio button and click Next
Choose the Place all certificates in the following store radio button and click Browse
Choose the Trusted Root Certification Authorities and click OK
Click Next
Click Finish
You’ll get a Security Warning. Click Yes
Then you’ll get a message that the Import Was Successful. Hit OK
And click OK
Now right click on your app in the Solution Explorer Your App > Publish > Create App Package
Select Distribution Method. Choose the sideloading radio button and click Next
Make sure the radio button Yes use the current certificate is selected and click Next
Hololens2 needs ARM64 so make sure that checkbox is selected also and hit Create
Navigate to the folder in Windows Explorer that you gave as your file path to save the packages, and you can send these to your tester to save onto their Hololens 2.
I have another blog post that shows you how to copy it onto your Hololens 2 here