共用方式為


Download, build, and run the Windows SDK samples

[ This article is for Windows 8.x and Windows Phone 8.x developers writing Windows Runtime apps. If you’re developing for Windows 10, see the latest documentation ]

To make it easier for you to learn to develop Windows Store apps, we created hundreds of Windows SDK samples. This topic tells you how to download, build, and run these samples.

With Windows 8, we combined all of the samples across features of the platform into one single download location: the MSDN Gallery for Windows Store app samples. We've updated these samples for Windows 8.1.

The samples that are marked "Official Windows SDK Sample" come from Microsoft and were tested alongside the OS components. They provide examples of user experience best practices for Windows Store apps. The samples marked "Windows Content Team Instructional Samples" are designed to accompany documentation for common Windows Store app developer scenarios.

The MSDN Gallery for Windows Store app samples also contains samples that community members created.

Downloading the Windows SDK samples

To download samples, go to the MSDN Gallery for Windows Store app samples. The default view shows the top ten most downloaded samples, in descending order of popularity.

You can filter this view by language, affiliation (Official SDK samples or community-authored samples), technology (the platform feature), or topic family.

These links are grouped by popular topics to get you started:

Topic These samples demonstrate
App model The app model for your Windows Store apps, including contracts, capabilities, packaging, and other infrastructure components.
Audio and video The various multimedia, graphics, sound, and video technologies you can use in your Windows Store app, including DirectX and media streaming.
Devices and sensors The types of devices and sensors you can use in your Windows Store app.
Globalization The set of APIs for globalization and localization of your Windows Store app.
Networking The networking technologies, from TCP and UDP sockets to HTTP services, that you can use in your Windows Store app.
Security The security features and APIs you can use in your Windows Store app.
Services The various network, social, and cloud services available to your Windows Store app.
Storage The set of APIs your Windows Store app uses to access storage, including local, networked, device, and cloud storage options.
Store The APIs used to prepare your Windows Store app for the Windows Store.
User interface The set if APIs used to develop a fast and fluid UI for your Windows Store app.

 

You download samples as compressed ZIP (.zip) files. To extract the sample, double-click the downloaded ZIP file and extract or copy the files and folders inside it to a local folder, such as My Documents or a Visual Studio projects folder.

Note   If you download a sample to an EFS protected folder and then attempt to load and run it in Microsoft Visual Studio 2013 from that folder, it will fail. Unzip the download to an unencrypted folder before you load and run the sample.

 

Opening a Windows SDK sample in Visual Studio 2013

To use our samples, you must have a computer running a version of Windows 8.1, where you will build and run the samples. You must also have a version of Visual Studio 2013 installed on that computer. You can download Windows 8.1 and Microsoft Visual Studio Express 2013 for Windows here.

You can open a sample by launching Visual Studio 2013 and opening the Visual Studio solution (.sln) file by going to File > Open > Project/Solution... (or pressing Ctrl-Shift-O) in the menu bar and then using the file selector to find and choose the .sln file for the sample. Or you can use Windows Explorer to navigate to the .sln file for the sample and then double-click it.

If you have successfully completed this task, you will see the list of folders and files that comprise the sample in the Solution Explorer pane on the right.

Building and running a Windows SDK sample

You must build a sample before you can run it. To build a sample, open the solution (.sln) file for the sample (such as "AssociationLaunching.sln" for the Association Launching sample) from Visual Studio 2013 for Windows 8.1 (any SKU), or double-click the solution file from Windows Explorer.

After the solution opens, go to Build > Build Solution (or press F7) from the menu bar to build the sample after it has loaded. The debug pane on the bottom of the screen indicates that the solution has been successfully built.

To run a Visual Basic, C#, or Visual C++ sample, go to the installation folder for this sample with Windows Explorer and run the executable file <name_of_sample>.exe from the <sample_install_root>\bin\Debug folder. Or press F5 (run with debugging enabled) or Ctrl-F5 (run without debugging enabled). (Or select the corresponding options from the Debug menu.) If you are successful, the sample will launch in the emulator.

For a JavaScript sample, there is no executable file. Press F5 to run the app with debugging enabled or Ctrl-F5 to run without debugging enabled. To test it without Visual Studio, you must deploy it.

Note  If you are using Windows 8.1 as your development environment, you can deploy the sample app after building it and then run it from the Start Screen as you would any other Windows Store app. To deploy an app you just built, select Build > Deploy Solution from the menu bar.

 

Roadmap for Windows Runtime apps using JavaScript

Roadmap for Windows Runtime apps using C# or Visual Basic

Roadmap for Windows Runtime apps using C++