Using Visual Studio

Whether you want to use DirectX or Unity to develop your Holographic app, you will use Visual Studio 2015 for debugging and deploying apps. In this section, you will learn:

  • How to deploy applications to your HoloLens through Visual Studio.
  • How to use the HoloLens emulator built in to Visual Studio 2015.
  • How to debug holographic applications.

Prerequisites

  1. See Install the Tools for installation instructions.
  2. Create a new Universal Windows app project in Visual Studio 2015 Update 1 for a 2D Windows 10 app or start use Unity to create a holographic app. C#, C++, and JavaScript projects are all supported on HoloLens.

Enabling Developer Mode

Before you can connect developer tools to your HoloLens, you first need to enable Developer Mode on the device.

  1. Turn on your HoloLens and put on the device.
  2. Perform the bloom gesture to launch the main menu.
  3. Gaze at the Settings tile and perform the air tap gesture. Perform a second air tap to place the app in your environment. The Settings app will launch after you place it.
  4. Select the Update menu item.
  5. Select the For developers menu item.
  6. Enable Developer Mode. This will allow you to deploy apps from Visual Studio to your HoloLens.
  7. Optional: Scroll down and also enable Device Portal. This will also allow you to connect to the Windows Device Portal on your HoloLens from a web browser.

Deploying an app over Wi-Fi

  1. Select an x86 build configuration for your app

x86 build configuration in Visual Studio

  1. Select Remote Machine in the deployment target drop-down menu

Remote machine deployment target in Visual Studio

  1. For C++ and JavaScript projects, go to Project > Properties > Configuration Properties > Debugging. For C# projects, a dialog will automatically pop-up to configure your connection.
    1. Enter the IP address of your device in the Address or Machine Name field. Find the IP address on your HoloLens under Settings > Network & Internet > Advanced Options, or you can ask Cortana "What is my IP address?"
    2. Set Authentication Mode to Universal (Unencrypted protocol)

Remote connection dialog in Visual Studio

  1. Select Debug > Start debugging to deploy your app and start debugging

Start Without Debugging in Visual Studio

  1. The first time you deploy an app to your HoloLens from your PC, you will be prompted for a PIN. Follow the Pairing your device instructions below.

If your HoloLens IP address changes, you can change the IP address of the target machine by going to Project > Properties > Configuration Properties > Debugging

Deploying an app over USB

  1. Select an x86 build configuration for your app

x86 build configuration in Visual Studio

  1. Select Device in the deployment target drop-down menu

Device deployment in Visual Studio

  1. Select Debug > Start debugging to deploy your app and start debugging

Start Without Debugging in Visual Studio

  1. The first time you deploy an app to your HoloLens from your PC, you will be prompted for a PIN. Follow the Pairing your device instructions below.

Pairing your device

The first time you deploy an app from Visual Studio to your HoloLens, you will be prompted for a PIN. On the HoloLens, generate a PIN by launching the Settings app, go to Update > For Developers and tap on Pair. A PIN will be displayed on your HoloLens; type this PIN in Visual Studio. After pairing is complete, tap Done on your HoloLens to dismiss the dialog. This PC is now paired with the HoloLens and you will be able to deploy apps automatically. Repeat these steps for every subsequent PC that is used to deploy apps to your HoloLens.

To un-pair your HoloLens from all computers it was paired with, launch the Settings app, go to Update > For Developers and tap on Clear.

Deploying an app to the HoloLens Emulator

  1. Make sure you have installed the HoloLens Emulator.
  2. Select an x86 build configuration for your app

x86 build configuration in Visual Studio

  1. Select HoloLens Emulator in the deployment target drop-down menu

Emulator target in Visual Studio

  1. Select Debug > Start debugging to deploy your app and start debugging

Start Without Debugging in Visual Studio

Graphics Debugger

The Visual Studio Graphics Diagnostics tools are very helpful when writing and optimizing a Holographic app. See Visual Studio Graphics Diagnostics on MSDN for full details.

To Start the Graphics Debugger with HoloLens

  1. Follow the instructions above to target a HoloLens device or emulator
  2. Go to Debug > Graphics > Start Diagnostics
  3. The first time you do this, you may get an "access denied" error. Reboot your HoloLens to allow updated permissions to take effect and try again.

Profiling

The Visual Studio profiling tools allow you to analyze your app's performance and resource use. This includes tools to optimize CPU, memory, graphics, and network use. See Run diagnostic tools without debugging on MSDN for full details.

To Start the Profiling Tools with HoloLens

  1. Follow the instructions above to target a HoloLens device or emulator
  2. Go to Debug > Start Diagnostic Tools Without Debugging...
  3. Select the tools you want to use
  4. Click Start
  5. The first time you do this, you may get an "access denied" error. Reboot your HoloLens to allow updated permissions to take effect and try again.

Debugging an installed or running app

You can use Visual Studio to debug an app that's installed on your HoloLens without deploying from a Visual Studio project. This is useful if you want to debug an installed app package, or if you want to debug an app that's already running.

These steps require Visual Studio 2015 Update 3.

  1. Install Visual Studio 2015 Update 3
  2. Go to Debug -> Other Debug Targets -> Debug Installed App Package
  3. Select the Remote Machine target
  4. Enter your device’s IP address
  5. Choose the Universal Authentication Mode
  6. The window shows both running and inactive apps. Pick the one what you’d like to debug.
  7. Choose the type of code to debug (Managed, Native, Mixed)
  8. Click Attach or Start

See also