次の方法で共有


Refresh a UWP app 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

You can make changes to your code while you're debugging, and then refresh a UWP app using JavaScript by choosing the Refresh Windows app button on the Debug toolbar. Choosing this button reloads the app without stopping and restarting the debugger. The Refresh feature enables you to modify HTML, CSS, and JavaScript code and quickly see the result. This feature is supported for UWP apps.

Refresh doesn't maintain your app state or reflect the following changes to your app:

  • Package manifest file changes, including changes to images specified in the package manifest.

  • Reference changes, such as adding or removing an SDK reference, or changes to Windows Runtime Components (.winmd files).

  • Resource changes, such as changes to strings in .resjson files.

  • Project file changes that result in path name changes, new project files, or deleted files.

  • Project and item property changes, such as changes to the selected debugging device, or changes to the package action for a file (in the Properties window).

Important

When you change references, change the package manifest, or make other changes specified in the preceding list, you have to stop and restart the debugger to update HTML, CSS, and JavaScript source files.

To refresh an app

  1. With your UWP project open in Visual Studio, select Local Machine as the debug target.

    Select debug target list

  2. Press F5 to run the app in debug mode.

  3. Switch to Visual Studio.

  4. In the home page of your UWP app, edit some of the HTML.

  5. Click the Refresh Windows app button, which looks like this: Refresh Windows app button. (Or press F4.)

  6. Switch to the app. The app is reloaded and the updated HTML is used to render the app.

See also