Install Published Samples with Visual Studio

Anthony D. Green [MSFT]

You can use Visual Studio 2012 RC  to download and install samples from the MSDN Code Gallery.  You can download only the samples you need, or you can download one or more Sample Packs, which group several samples that relate to a technology or topic. You’ll receive a notification if source code changes are published for any sample that you download.

To locate the samples, open the New Project dialog, and then expand the Online tab, and then the Samples node.

To locate the sample packs, choose Tools, Extensions and Updates on the menu bar. In the Extensions and Updates dialog box, expand the Online tab, and then expand the Samples Gallery node. After you install a sample pack, you can install the individual samples from the Installed tab of the New Project dialog box.

Working Copy and Master Copy

When you install an online sample, the solution is stored in two locations:

    • A working copy is stored in the location that you specify by using the New Project dialog box.
    • A separate master copy is stored on your computer.

After you install a sample, it appears on the Installed tab of the New Project dialog box. You can create new working copies from the master copy without remembering where you found the sample on the web and without being connected to the Internet.

If a sample is no longer useful, you can remove the master copy from the Extensions and Updates dialog box, which you can open by choosing Tools, Extensions and Updates. Removing the master copy doesn’t remove any working copies that you created.

You’ll receive a notification if source code changes are published for an installed master copy of a sample. The notification will appear in both the Windows notification area when Visual Studio is open and on the Updates tab of the Extensions and Updates dialog box. If you update a sample, you’ll replace the master copy but not any working copies.

Installing a Sample

  1. To install a sample, choose File, New, Project.  In the New Project dialog box, expand the Online tab, and then expand the Samples node.
  2. Find the samples that you want by opening the nodes for the programming language, the platform, and the technology and then choosing the topic.  Or you can use the Search Installed Samples box in the top-right corner. Choose a sample that you want to install.
  3. For the Name, specify a name for the first working copy of the sample.  When you install the sample, the Name will become the name of the folder and the name of the solution file. Names of other files in the working copy will stay the same as those in the master copy. The Name doesn’t apply to the master copy.
  4. For the Location, specify a folder.  The location is where the working copy, not the master copy, will be installed. Note that the default value is a Samples folder and not a Projects folder.
  5. Click OK.  If you agree with the license terms, click Install.  A working copy of the solution is stored in the location that you specified, and a separate master copy is stored on your computer.

You can open a working copy of an installed sample by using the Open Project dialog box. Note that the default location for the working copy was the Samples folder, not the Projects folder.

Managing the Master Copy of an Installed Sample

  1. You can create a working copy of an installed sample from its master copy, or you can disable or uninstall the master copy.  Let’s look at two dialog boxes where you can access the master copy.
  2. Open the New Project dialog box, then expand the Installed tab, and expand the Samples node.  Expand the nodes for the programming language, the platform, and the technology, and then choose the topic.
  3. The master copies of the samples that you’ve installed appear.  Double-click a sample to create a new working copy.  On the Installed tab, you can create working copies from the master copy without remembering where you found the sample on the web or being connected to the Internet.
  4. Close New Project dialog box and open Tools, Extensions and Updates.
  5. In the Extensions and Updates dialog, choose the Installed tab, and then expand the Samples node.  The master copies of the samples that you’ve installed appear.  You can disable or uninstall master copies without affecting any working copies that you’ve created.
    Note that if source code changes have been published for any sample that you installed, a notification appears on the Update tab. For each update listed, you can choose the Update button to update your master copy.

Installing a Sample Pack

  1. Choose Tools, Extensions and Updates.  In the Extensions and Updates dialog box, expand the Online tab, and then expand the Samples Gallery node.
  2. Find the sample pack that you want by using the Search Samples Gallery box in the top-right corner or by expanding the nodes for the programming language, the platform, and the technology and then choosing the topic.
  3. Choose a sample pack, and click Download.  If you agree with the license terms, click Install.  The sample pack is installed on your computer, but working copies of the samples haven’t been created. 
  4. Close Extensions and Updates and choose File, New, Project.  In the New Project dialog, expand the Installed tab, and then expand the Samples node.  Browse the nodes or use the Search Installed Samples box in the top–right corner to find the samples that you installed.  Double-click the sample to create a new working copy of that sample.

For more information, see A World of Samples at your Fingertips.

Thanks to Anthony Cangialosi for providing technical information.

0 comments

Leave a comment

Feedback usabilla icon