Introduction
Previously in order to access the code samples from Microsoft site, we have to go to http://code.msdn.microsoft.com site > search for the code > download the project > open it in visual studio. But from Visual Studio 2012, Microsoft has integrated the code samples as a part of visual studio IDE (File > Search Code Samples). The below image shows the difference of menu item (Search Code Samples) between visual studio 2012 and visual studio 2010.
Once we click on Search Code Samples menu item, Visual Studio opens a window with MSDN code samples. From the samples, we can select/search for code and click on download button then it downloads the project to local system folder (C:\Users\username\Documents\Visual Studio 2012\Samples).
Note: Once the code sample is downloaded then if you select the same code sample again, instead of download button you can see open button.
Search Code Samples window:
Search Code Samples window consists of 3 tabs
- MSDN Sample Gallery
- Search & Download
- Sample Request Service
MSDN Sample Gallery:
Tab consists of featured category samples (All-In-One Code Framework, Windows 8, General Windows, Windows Driver Kit, Windows Azure, WPF, Windows Forms, HTML5, Windows Phone 7, ASP.NET, Silverlight, Internet Explorer Development, Microsoft Office and SharePoint). If we select any of category, it takes to respective code samples.
Search & Download
From the tab, we can search for a particular code and download it. Even we can add code sample to favorites, which saves to Favorites tab to access later.
Sample Request Service:
If we did not find code from samples then we can submit a request to Microsoft through codeplex site. Procedure to apply for new request is explained in Sample Request Service tab.
Short Cut:
From visual studio without going to menu File > Search Code Samples tab, we can search for code samples from toolbar itself. Please see the highlighted part of below image.
Happy search !