<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Visual Studio Tutor</title>
	<atom:link href="http://www.visualstudiotutor.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.visualstudiotutor.com</link>
	<description>Visual Studio Tutorials and Tips</description>
	<lastBuildDate>Thu, 19 Aug 2010 08:55:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Manage Database Projects With Visual Studio 2010</title>
		<link>http://www.visualstudiotutor.com/2010/08/manage-database-projects-with-visual-studio-2010/</link>
		<comments>http://www.visualstudiotutor.com/2010/08/manage-database-projects-with-visual-studio-2010/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 08:55:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[SQL Server]]></category>

		<guid isPermaLink="false">http://www.visualstudiotutor.com/?p=57</guid>
		<description><![CDATA[Introduction
Prior to Microsoft Visual Studio 2005, managing database projects had been a real challenge. Microsoft Visual Studio 2005 Database Professional Edition (also known as Data dude) simplified this process and Microsoft Visual Studio 2008 Database Edition GDR 2 further, along with several bug fixes, enhanced its capability to support newest feature of SQL Server 2008. New release i.e. Microsoft Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p><span>Prior to Microsoft Visual Studio 2005, managing database projects had been a real challenge. Microsoft Visual Studio 2005 Database Professional Edition (also known as Data dude) simplified this process and Microsoft Visual Studio 2008 Database Edition GDR 2 further, along with several bug fixes, enhanced its capability to support newest feature of SQL Server 2008. New release i.e. Microsoft Visual Studio 2010 brings a whole lot of new features and enhancements compared to its earlier versions. For example, you can now connect to SQL Server from Visual Studio IDE (Integrated Development Environment) itself with new in-built T-SQL Editor without actually going to SQL Server Management Studio (SSMS), you will get T-SQL Intellisence support while writing or modifying your T-SQL code etc.</span></p>
<p><span>Microsoft Visual Studio 2010 (not all editions, see note below for more details) allows to create and configure a database or server project as offline representation of your user databases or master database, which you can add to VSTF (Visual Studio Team Foundation) for version control and collaborative development. This reduces the risk of overwriting the offline representation, improves the communication among developers and helps your database development process to be become a part of regular software development life cycle.</span></p>
<h2>Getting started…</h2>
<p><span>Microsoft Visual Studio 2010 provides several templates to work with database development. For example Database Project, Database Project Wizard, Server Project, Data tier application etc. In this article, I am going to discuss about creating database project using Database Project and Database Project Wizard templates for user databases. Rest I will be talking of in the next couple of articles.</span></p>
<table style="margin-left: 9.6pt; border-collapse: collapse; border: none;" border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="width: 463.8pt; border: solid windowtext 1.0pt; padding: 0in 5.4pt 0in 5.4pt;" width="618" valign="top"><strong><em><span>Note:<br />
</span></em></strong><em><span style="font-family: &amp;amp;amp;">I am using Microsoft Visual Studio 2010 Ultimate edition RTM for all these examples and demonstration though database project development is supported in couple of other editions as well. To learn more about edition wise supported features </span></em><a rel="nofollow" href="http://www.microsoft.com/visualstudio/en-us/products"><em><span>click here.</span></em></a></td>
</tr>
</tbody>
</table>
<p style="margin-top: 12.0pt; text-justify: inter-ideograph;"><span style="font-family: &amp;amp;amp;">Launch Microsoft Visual Studio 2010 IDE (Integrated Development Environment) by going to START -&gt; Programs -&gt; Microsoft Visual Studio 2010 and then go to File -&gt; New and you will see a screen like this. You can choose here to create a blank project and add/import database schema objects later on after project creation or choose to initiate a wizard which will walk you through importing database objects as part of project creation.<br />
Once a project is created, if required, you can right click on the project and import scripts from one or more files into the project.</span></p>
<p><a href="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image001.jpg"><img class="alignnone size-full wp-image-65" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image001.jpg" alt="Manage Database Projects With Visual Studio 2010" width="614" height="451" /></a></p>
<p><span>In the New Project dialog box, select SQL Server under Database node in the left side tree view and the select SQL Server 2008 Wizard (or SQL Server 2005 Wizard depending on your database version). Specify the name of the project, location and solution name for this database project in their respective text boxes as shown above and click on OK button which will bring up a New Database Project Wizard welcome screen as shown below.</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image002.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p>Simply click on the Next button to move on to the next screen as shown below:</p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image003.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p>In the above screen you can specify some of the properties of the project you are creating, for example you can specify whether you want to a create database project for user database or SQL Server project for master database (choose database project as we are creating a project for user database development), how do you want you script files to be created, it should be created by schema name or by the type of database objects. Next you can specify to include schema name in the script files being created. Click on Next button to move on to the next screen which is shown below:</p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image004.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p><span>In the above screen you can specify different user database level options (for example ANSI paddings, ANSI nulls, Arithmetic abort etc. to be either ON or OFF by default), user database default collation and default schema. Click on Next button to move on to the next screen which is shown below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image005.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p><span>In the above screen you specify the source database connection from where you want to import user database schema objects (if a connection already available you can select it from the provided combo-box, if you want to modify an existing connection click on Edit Connection button or click on New Connection if you want to create an altogether new connection), along with that you can also specify the different import options which will be used during importing database objects and number of maximum files (the script for each database object is saved in a single file) in a one directory. Click on Next button to move on to the next screen which is shown below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image006.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p><span>In the above screen you specify different options which will be used when you build and deploy your database project to a SQL Server instance. For example you specify the target server connection string and target database name, whether the collation of the project will be used or default collation of the server will be used instead for the user database etc. I will be talking more about deployment options later when I will demonstrate how to deploy your database project in the next section. Click on Finish button to start creating the project, next screen will display the progress as shown below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image007.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p><span>If there is any problem while creating database project and importing database schema objects, the above screen will display the error message or else click on Finish button to close the wizard and return to the IDE. Here you can see your created database project along with all the schema objects in it.</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image008.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /></p>
<p><span>You can switch between Solution Explorer view and Schema view using the small icons in the top row of explorer as shown below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image009.jpg" alt="Manage Database Projects With Visual Studio 2010" /></p>
<p><span>Above you saw objects in Solution explorer view, below is the what you will see when you switch to Schema view where each schema contains all the objects owned by it/organized under it. </span><br />
<img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image010.jpg" alt="Manage Database Projects With Visual Studio 2010" width="304" height="434" /></p>
<p><span>You can double click on the any of the object to open it in editor where you can modify it as per your need, for example as shown below for a table. If you want to add a new object, simply right click on the folder and click on Add (in Solution Explorer right click on the folder, click on the type of object you want to create or simply click on New Item to specify the type of object in another dialog box).</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image011.jpg" alt="Manage Database Projects With Visual Studio 2010" width="626" height="415" /></p>
<p><span>You can notice that the above script only contains table creation part (for [HumanResources].[Department] table) and does not have script to create primary key as shown in Schema View on the right side for the same table. The reason is, primary key in itself is an object and hence it has been placed in separate file (double click on it to open it) as you can see below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image012.jpg" alt="Manage Database Projects With Visual Studio 2010" width="626" height="255" /><br />
<span style="font-family: &amp;amp;amp;">Let me show you how you can create a new database object. Right click on Project and click on –&gt; New -&gt; New Item, you will see a screen like this.</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image013.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="431" /> </p>
<p><span>In the above screen I am creating a view and selected the View template out of all the available templates and provided its name in the Name textbox. This will bring up an editor window as shown below where you can write code for your view.</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image013.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="269" /> </p>
<p style="margin-top: 12.0pt; margin-right: 0in; margin-bottom: .0001pt; margin-left: 0in;"><span style="font-size: 10.0pt;">In the above screen you can see the Intellisence feature in action. Good part about Intellisense feature is, it works both in project mode (offline representation of the database) when not connected to the server and in connected mode when connected to the server.</span></p>
<p style="margin-top: 12.0pt; margin-right: 0in; margin-bottom: .0001pt; margin-left: 0in;"><span>Microsoft visual Studio 2010 also includes T-SQL editor in the IDE itself as you can see below, so you don’t need to go to SSMS (SQL Server Management Studio) to connect to server and work, simply connect to the server from IDE itself and you are ready to browse through databases and database objects.</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image015.jpg" alt="Manage Database Projects With Visual Studio 2010" width="626" height="70" /> </p>
<p><span style="font-family: &amp;amp;amp;">You can open up a new query window using “New Query” and write and execute your query as shown below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image016.jpg" alt="Manage Database Projects With Visual Studio 2010" width="624" height="231" />  </p>
<p><br style="page-break-before: always;" /></p>
<h2>Deploying your projects…</h2>
<p><span>Before deployment you need to configure different deployment properties and build the project. Right click on the project node in Solution Explorer (or press ALT+Enter) and select Properties to configure these properties. Click on Deploy page on the left side and you will see a screen like this: </span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image017.jpg" alt="Manage Database Projects With Visual Studio 2010" width="626" height="452" />  </p>
<p><span>In the above screen you can specify different properties, for example whether you want just to create a deployment script or want to create a deployment script and also deploy it, what would be name of the deployment script file which will be created, target server connection string and the target database name in the respective textbox.</span></p>
<p><span>Once you are done with these configurations, you can build your project by using Build option in Menu bar (or by simply hitting F6 key) or simply build and deploy by using Deploy option in Menu bar as shown below: </span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image018.jpg" alt="Manage Database Projects With Visual Studio 2010" width="492" height="314" />  </p>
<p><span  >Once deployed you can connect to the server and verify it as shown below:</span></p>
<p><img class="alignnone size-full wp-image-66" title="Manage Database Projects With Visual Studio 2010" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/image019.jpg" alt="Manage Database Projects With Visual Studio 2010" width="299" height="411" />   </p>
<p><span class="Heading1Char"><span style="font-size: 14.0pt; font-family: &amp;amp;amp;"><br style="page-break-before: always;" /><br />
</span></span></p>
<h2>Conclusion</h2>
<p><span>In this article, I showed you how you can use Microsoft Visual Studio 2010 ultimate edition to create offline representation of user database by creating a database project in it. Then I showed you how can make changes to this offline representation and deploy these changes to the SQL Server instance. </span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualstudiotutor.com/2010/08/manage-database-projects-with-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Studio LightSwitch First Look</title>
		<link>http://www.visualstudiotutor.com/2010/08/visual-studio-lightswitch-first-look/</link>
		<comments>http://www.visualstudiotutor.com/2010/08/visual-studio-lightswitch-first-look/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 04:15:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[LightSwitch]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.visualstudiotutor.com/?p=49</guid>
		<description><![CDATA[Visual Studio LightSwitch  (previously codenamed Kitty Hawk) is a new VS extension from Microsoft which is targeted at professional developers  looking to create custom enterprise apps using data from multiple sources.
Developers building apps for large enterprises often encounter the problem that the data required to be pulled into the app exists in numerous [...]]]></description>
			<content:encoded><![CDATA[<p>Visual Studio LightSwitch  (previously codenamed Kitty Hawk) is a new VS extension from Microsoft which is targeted at professional developers  looking to create custom enterprise apps using data from multiple sources.</p>
<p>Developers building apps for large enterprises often encounter the problem that the data required to be pulled into the app exists in numerous different repositories such as SQL Server databases, SharePoint, SQL Azure, and WCF services. Visual Studio LightSwitch allows developers to seemless integrate this disparate data sources into a unified model which they can work with using the Visual Studio design surface.</p>
<p>The task of creating apps is further simplified with the inclusion of several inbuilt templates (complete with boilerplate code and design layout) for common app features such as screens for creating new records:</p>
<p><img class="alignnone size-full wp-image-51" title="LightSwitch" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/lightswitch1.jpg" alt="LightSwitch" width="608" height="462" /></p>
<p><em>LightSwitch Templates</em></p>
<p>Apps built using LightSwitch can also integrate with Office 2010, the below screenshot shows data exported to Excel:</p>
<p><img class="alignnone size-full wp-image-52" title="LightSwitch" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/08/lightswitch2.jpg" alt="LightSwitch" width="608" height="462" /></p>
<p><em>LightSwitch exporting data to Excel</em></p>
<p>LightSwitch apps will all be Silverlight based apps which can use with C# or VB or their core programming language.  Deployment is simplified and applications  can be deployed to the client, browser, or even  Azure.</p>
<p>Details are still a bit thin on LightSwitch but I will update this overview once the  beta is released  on August 23 (to MSDN Subscribers only at first). A final version is planned for release early next year.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualstudiotutor.com/2010/08/visual-studio-lightswitch-first-look/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio T4 (Text Template Transformation Toolkit) Files</title>
		<link>http://www.visualstudiotutor.com/2010/02/visual-studio-t4-text-template-transformation-toolkit-files/</link>
		<comments>http://www.visualstudiotutor.com/2010/02/visual-studio-t4-text-template-transformation-toolkit-files/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 11:46:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.visualstudiotutor.com/?p=31</guid>
		<description><![CDATA[T4 is a Visual Studio code-generation language which was introduced with Visual Studio 2005. T4 templates are used in the Entity Framework and MVC and can be useful for your own development purposes.
T4 is not tightly integrated into Visual Studio and there iss no item templates in File &#62; New Item and no intellisense or [...]]]></description>
			<content:encoded><![CDATA[<p>T4 is a Visual Studio code-generation language which was introduced with Visual Studio 2005. T4 templates are used in the Entity Framework and MVC and can be useful for your own development purposes.</p>
<p>T4 is not tightly integrated into Visual Studio and there iss no item templates in File &gt; New Item and no intellisense or syntax highlighting. To use T4 templates create a file with the extension .tt, add some text content, save the file, and then Visual Studio generates a code file from your template.</p>
<p>You can use complex logic by utilizing the T4 templating language to modify the output generated depending on various conditions. T4 templates in Visual Studio 2010 are compiled saved, thus they are essentially an additional type that can be instantiated in code. Scott Hanselman wrote a very good roundup of this in his article at <a href="www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx">www.hanselman.com/blog/T4TextTemplateTransformationToolkitCodeGenerationBestKeptVisualStudioSecret.aspx</a></p>
<p>To enable Intellisense for T4 templates you will need to download and install the Tangible T4 plugin at<br />
<a href="http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23"> http://visualstudiogallery.msdn.microsoft.com/en-us/60297607-5fd4-4da4-97e1-3715e90c1a23</a>.</p>
<p>The definitive online guide for T4 information is at <a href="http://www.olegsych.com/2007/12/text-template-transformation-toolkit/">http://www.olegsych.com/2007/12/text-template-transformation-toolkit/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualstudiotutor.com/2010/02/visual-studio-t4-text-template-transformation-toolkit-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Customize the Start Page in Visual Studio 2010</title>
		<link>http://www.visualstudiotutor.com/2010/02/customize-the-start-page-in-visual-studio-2010/</link>
		<comments>http://www.visualstudiotutor.com/2010/02/customize-the-start-page-in-visual-studio-2010/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 11:08:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Start Page]]></category>

		<guid isPermaLink="false">http://www.visualstudiotutor.com/?p=28</guid>
		<description><![CDATA[Visual Studio 2010 allows for customization of  the start page, this feature can be  used this feature to display items such as  build status, current bugs,  etc.

1. Navigate to the StartPages folder in File Explorer (in Windows Vista and Windows 7 this is located at C:\Users\[username]\Documents\Visual Studio\10\StartPages). Open StartPage.csproj and note that the StartPage.xaml file is a standard XAML page [...]]]></description>
			<content:encoded><![CDATA[<div id="_mcePaste">Visual Studio 2010 allows for customization of  the start page, this feature can be  used this feature to display items such as  build status, current bugs,  etc.</div>
<div></div>
<div>1. Navigate to the StartPages folder in File Explorer (in Windows Vista and Windows 7 this is located at C:\Users\[username]\Documents\Visual Studio\10\StartPages). Open StartPage.csproj and note that the StartPage.xaml file is a standard XAML page with some Visual Studio-specific controls to shows items such as recently opened projects.</div>
<div id="_mcePaste">2. Modify the StartPage.xaml file to include your custom text.</div>
<div id="_mcePaste">3. Save the file using a different  file name, such as MyStartPage.xaml (save this file in the  same directory).</div>
<div>4. In Visual Studio navigate to Tools&gt;Options and select the startup node, then select your customized start page from the Custom Page dropdown.</div>
<div>5. Restart Visual Studio and your customized page should be visible</div>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.visualstudiotutor.com/2010/02/customize-the-start-page-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Snippet in Visual Studio 2010</title>
		<link>http://www.visualstudiotutor.com/2010/02/create-snippet-visual-studio-2010/</link>
		<comments>http://www.visualstudiotutor.com/2010/02/create-snippet-visual-studio-2010/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 10:20:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.visualstudiotutor.com/?p=18</guid>
		<description><![CDATA[Pre-2010 versions of  Visual Studio had a  snippets feature which allowed users to  save code blocks for later insertion. Visual Studio 2010 contains a numerous new snippets (especially ASP.NET snippets) and allows users to easily create their own snippets. Creating snippets in VS2008 was possible but without using third-party tools it was a tricky process.
VS 2010 greatly simplifies [...]]]></description>
			<content:encoded><![CDATA[<div>Pre-2010 versions of  Visual Studio had a  snippets feature which allowed users to  save code blocks for later insertion. Visual Studio 2010 contains a numerous new snippets (especially ASP.NET snippets) and allows users to easily create their own snippets. Creating snippets in VS2008 was possible but without using third-party tools it was a tricky process.</div>
<div>VS 2010 greatly simplifies the process of creating custom snippets.</div>
<div>There are two types of snippets in VS 2010, Expansion Snippets which are inserted at the cursor and SurroundsWith Snippets which wraps around existing code.</div>
<h2>Creating a Snippet in Visual Studio 2010</h2>
<div>In this walkthrough we will create a code file header snippet.</div>
<div>
<ol>
<li> Add a new XML file to your project and name it sampleHeader.snippet (Visual Studio snippets always have the extension .snippet).</li>
<li>Right-click on the editor window and select Insert Snippet to create a basic snippet template. Since we are creating an Expansion Snippet, remove the tag : &lt;snippetType&gt;SurroundsWith&lt;/snippetType&gt;</li>
<li>Alter the Title tag to read “Code File Header.”</li>
<li>Change the Author tag to your own name.</li>
<li>Change the Shortcut tag (which is the trigger word that activates your snippet) to “vstutor”</li>
<li>Enter a description for this snippet, for example “Adds  header to the code file”.</li>
<li>Since we are creating a  C# snippet alter the Language attribute of the Code tag so it reads &lt;Code Language=&#8221;CSharp&#8221;&gt; . Snippets can be creating for any language such as Visual Basic, XML etc</li>
<li>The Code section contains the code block to be added. In this example, modify the code section till it reads:&lt;Code Language=&#8221;CSharp&#8221;&gt;&lt;![CDATA[***********************************
<p>Author: $Author$</p>
<p>Date:</p>
<p>Version:</p>
<p>Purpose:</p>
<p>***********************************</p>
<p>]]&gt;</p>
<p>&lt;/Code&gt;</li>
</ol>
</div>
<p>The  finished version of the snippet appear as below:<br />
&lt;CodeSnippet Format=&#8221;1.0.0&#8243; xmlns=&#8221;http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet&#8221;&gt;</p>
<p>&lt;Header&gt;</p>
<p>&lt;Title&gt;Code File Header&lt;/Title&gt;</p>
<p>&lt;Author&gt;Test Author&lt;/Author&gt;</p>
<p>&lt;Shortcut&gt;vstutor&lt;/Shortcut&gt;</p>
<p>&lt;Description&gt;Adds a header to a code file&lt;/Description&gt;</p>
<p>&lt;SnippetTypes&gt;</p>
<p>&lt;SnippetType&gt;Expansion&lt;/SnippetType&gt;</p>
<p>&lt;/SnippetTypes&gt;</p>
<p>&lt;/Header&gt;<br />
&lt;Snippet&gt;</p>
<p>&lt;Declarations&gt;</p>
<p>&lt;Literal&gt;</p>
<p>&lt;ID&gt;Author&lt;/ID&gt;</p>
<p>&lt;Default&gt;Alex Mackey&lt;/Default&gt;</p>
<p>&lt;/Literal&gt;</p>
<p>&lt;/Declarations&gt;</p>
<p>&lt;Code Language=&#8221;CSharp&#8221;&gt;</p>
<p>&lt;![CDATA[</p>
<p>***********************************</p>
<p>Author: $Author$</p>
<p>Date:</p>
<p>Version:</p>
<p>Purpose:</p>
<p>***********************************</p>
<p>]]&gt;</p>
<p>&lt;/Code&gt;</p>
<p>&lt;/Snippet&gt;</p>
<p>&lt;/CodeSnippet&gt;</p>
<h2>Load Snippets into Visual Studio</h2>
<p>Before the snippet can be used it will need to be loaded in Visual Studio. It is best practice to create a folder to hold all your snippets, to do this and load the folder follow the below steps:</p>
<div>1. Copy the sampleHeader.snippet file from the VS solution to your snippets folder.</div>
<div>2. In the main menu, navigate to Tools and then Code Snippets Manager to get to the Code Snippets Manager</div>
<div>3. Select Import</div>
<div id="_mcePaste">4. Select your snippet</div>
<div id="_mcePaste">5. Click OK</div>
<div id="_mcePaste">6. Visual Studio will then prompt you to confirm you wish to place the snippet in My Code Snippets folder.</div>
<div></div>
<div id="_mcePaste">That’s it,  the custom snippet is now ready for use, try it out by typing vstutor in a code file. In the event you don&#8217;t know or remember the snippet name you can  open the snippet dialog by right-clicking in the editor and selecting Insert Snippet ( or  press Ctrl + K and then Ctrl + X to fire up the Insert Snippet enhancement  to navigate through snippets using the keyboard).</div>
]]></content:encoded>
			<wfw:commentRss>http://www.visualstudiotutor.com/2010/02/create-snippet-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Visual Studio Debugging Tutorial &#8211; Basics</title>
		<link>http://www.visualstudiotutor.com/2010/02/visual-studio-debugging-tutorial-basics/</link>
		<comments>http://www.visualstudiotutor.com/2010/02/visual-studio-debugging-tutorial-basics/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 08:22:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://www.visualstudiotutor.com/?p=3</guid>
		<description><![CDATA[If there&#8217;s a single feature of Visual Studio that every developer uses and is essential to the development process it is the built-in debugger.
Debugging can be commenced by clicking the green arrow button in the VS toolbar, selecting Debug-Strart Debugging from the menu, or hitting F5. Before commencing debugging you will need to select what [...]]]></description>
			<content:encoded><![CDATA[<p>If there&#8217;s a single feature of Visual Studio that every developer uses and is essential to the development process it is the built-in debugger.</p>
<p>Debugging can be commenced by clicking the green arrow button in the VS toolbar, selecting Debug-Strart Debugging from the menu, or hitting F5. Before commencing debugging you will need to select what exactly you are debugging, just starting debugging will commence the project from the default point. For a Web Forms app, if you want to start from another page other the default start page right click the page and select Set As Start Page. For a Win Forms app set the start Form in the application properties window first.</p>
<p>Prior to debugging, it will almost always be necessary to to set some breakpoints. Breakpoints pause the execution of the code and allow developers to examine controls and variables before allowing the program to continue to execute. Set a breakpoint by clicking in the margin of the code editor to and a red ball with code highlighted will appear (as shown below). The program&#8217;s execution will now be halted immediately <em>before </em>the highlighted line of code is hit.</p>
<p><img class="size-full wp-image-6 alignnone" title="ScreenHunter_01 Feb. 11 15.31" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/02/ScreenHunter_01-Feb.-11-15.31.gif" alt="ScreenHunter 01 Feb. 11 15.31 Visual Studio Debugging Tutorial   Basics" width="414" height="91" /></p>
<p>So if we now hit F5 and start debugging there should be a delay as the project is built and the code will then be highlighted in yellow with a yellow arrow at the left:<br />
<img class="alignnone size-full wp-image-7" title="ScreenHunter_02 Feb. 11 15.42" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/02/ScreenHunter_02-Feb.-11-15.42.gif" alt="ScreenHunter 02 Feb. 11 15.42 Visual Studio Debugging Tutorial   Basics" width="394" height="84" /></p>
<p>At this point we can view variable values by hovering over them. Hovering over the <em>vsTutor </em>variable shows a value of 0 , hovering over the<em> i </em>variable does not work as the highlighted line as not been executed and the<em> i </em>variable not instantiated.</p>
<p>There are a number of important windows to monitor objects as the code executes, these are located in the bottom left by default but if not visible they can be opened from Debug&gt;Windows.<br />
The <strong>Watch </strong>window allow monitoring of any object which can simply be highlighted in the code window and dragged to the Watch window. The Watch window monitor objects regardless of whether they are in scope or now.<br />
The <strong>Locals </strong>window cannot have objects dragged into it and shows all objects that are currently in scope. A powerful feature of the locals window is that it allow the objects to by modified. In this example, the value of the vsTutor variable can be modified by clicking and changing the number in the Value column.<br />
The <strong>Autos </strong>window shows the objects used in the execution of the current statement.<br />
The <strong>Immediate </strong>window allows for statements to be written and executed as the program&#8217;s execution is paused.<br />
The <strong>Breakpoints </strong>window allows the breakpoints for the project to be managed by enabling, disabling or deleting them.</p>
<p>At all times the yellow arrow shows the line of code that will be executed next. This arrow can be dragged down to execute subsequent lines of code without executing the code that it is dragged over.</p>
<p>When in debug mode the Debug toolbar will either appear in the main tool bar of Visual Studio or a floating toolbar as show below.</p>
<p><img class="alignnone size-full wp-image-11" title="ScreenHunter_04 Feb. 11 16.09" src="http://www.visualstudiotutor.com/wp-content/uploads/2010/02/ScreenHunter_04-Feb.-11-16.09.gif" alt="ScreenHunter 04 Feb. 11 16.09 Visual Studio Debugging Tutorial   Basics" width="305" height="59" /></p>
<p>The three buttons to the right of the yellow arrow are crucial to the debug process:<br />
<strong>Step Into </strong>executes the next line of code that the program would normally execute.<br />
<strong>Step Over </strong>proceeds to the next line of code in the current procedure, this means that other routines (such as functions) are called it will not proceed into those routines but simply execute them and continue to the next line of the current code block.<br />
<strong>Step Out </strong>will move to the line of code which called the current process or the next breakpoint if that comes first.<br />
In the next Debugging Tutorial we will proceed to examine more advanced Visual Studio debugging topics.</p>
<p>Note : The new WebMatrix web development tool has been released by Microsoft which features a well integrated suite of dev tools, check out <a href="http://www.aspnet101.com/2010/07/webmatrix-tutorial-part-1/">WebMatrix Tutorial</a> for more info</p>
]]></content:encoded>
			<wfw:commentRss>http://www.visualstudiotutor.com/2010/02/visual-studio-debugging-tutorial-basics/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
