Поделиться через


Debug an installed UWP app package in Visual Studio

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

Visual Studio can debug installed Universal Windows Platform (UWP) app packages on Windows 10 and newer computers and Xbox, HoloLens, and IoT devices.

Note

Visual Studio debugging for installed UWP apps is not supported on phones.

For more information about debugging UWP apps, see the blog posts on debugging installed app packages and building Universal Windows Apps (UWP).

Debug an installed UWP app on a local machine

  1. In Visual Studio, select Debug > Other Debug Targets > Debug Installed App Package.

  2. In the Debug Installed App Package dialog, under Connection Type, select Local Machine.

  3. Under Installed App Packages, select the app you want to debug, or type its name in the search box. Non-running installed app packages appear under Not running, and running apps are under Running.

    DebugInstalledAppPackage

  4. If necessary, change the code type under Debug this code type, and select other options.

    • Select Do not launch, but debug my code when it starts to start debugging when the app starts. Starting debugging when the app launches is an effective way to debug control paths from different launch methods, such as protocol activation with custom parameters.
  5. Select Start, or if the app is running, select Attach.

Note

You can also attach to any running UWP or other app process by selecting Debug > Attach to Process in Visual Studio. You don't need the original Visual Studio project to attach to a running process, but loading the app's symbols will help significantly when debugging a process that you don't have the original code for. See Specify symbol and source files in the debugger.

Debug an installed UWP app on a remote computer or device

The first time Visual Studio debugs an installed UWP app on a Windows 10 or newer device or a remote post-Creator's Update Windows 10 computer, it installs the remote debugging tools on the target device.

  1. Enable developer mode on the Visual Studio computer and the remote device or computer.

  2. If you are connecting to a remote computer running pre-Creator's Update Windows 10, manually install and start the remote debugger on the remote computer.

  3. On the Visual Studio computer, select Debug > Other Debug Targets > Debug Installed App Package.

  4. In the Debug Installed App Package dialog, under Connection Type, select Remote Machine or Device.

    If you select Device, your computer must be physically connected to a Windows 10 or newer device.

    For a remote machine, if the computer address doesn't appear next to Address, select Change.

    1. In the Remote Connection dialog box, next to Address, type the name or IP address of the computer you want to connect to.

      ChooseRemoteComputer

      If the debugger can't connect to a remote computer using the computer name, use the IP address instead. Use the IP address for Xbox, HoloLens, or IoT devices.

    2. Select an authentication option next to Authentication Mode.

      For most apps, keep the default value, Universal (Unencrypted Protocol).

    3. Select Select.

  5. Under Installed App Packages, select the app you want to debug, or type its name in the search box. Non-running installed app packages appear under Not running, and running apps are under Running.

  6. If necessary, change the code type under Debug this code type, and select other options.

    • Select Do not launch, but debug my code when it starts to start debugging when the app starts. Starting debugging when the app launches is an effective way to debug control paths from different launch methods, such as protocol activation with custom parameters.
  7. Select Start, or if the app is running, select Attach.

When you start debugging an installed app package on a connected Xbox, HoloLens, or IoT device for the first time, Visual Studio installs the correct version of the remote debugger for your target device. Installing the remote debugger may take some time, and the message Starting remote debugger displays while it is happening.

Note

Currently, an Xbox or HoloLens device restarts the app with the debugger attached if it was already running.

For more information on remote deployment of UWP apps, see Deploy and debug UWP apps and Debug UWP apps on remote machines.

See also