<?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>Codepolice.net &#187; macro</title>
	<atom:link href="http://codepolice.net/tag/macro/feed/" rel="self" type="application/rss+xml" />
	<link>http://codepolice.net</link>
	<description>C#, ASP.NET, MVC, LINQ, Wordpress and stuff like that</description>
	<lastBuildDate>Mon, 26 Jul 2010 08:58:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Quick attach to process in Visual Studio</title>
		<link>http://codepolice.net/2009/09/01/quick-attach-to-process-in-visual-studio/</link>
		<comments>http://codepolice.net/2009/09/01/quick-attach-to-process-in-visual-studio/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 09:09:47 +0000</pubDate>
		<dc:creator>Ola</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[attach]]></category>
		<category><![CDATA[macro]]></category>

		<guid isPermaLink="false">http://codepolice.net/?p=162</guid>
		<description><![CDATA[When i debug web applications i like to go with the attach to process instead of pressing F5 when i use IIS as the development web server. It has lot of advantages: If you are &#8220;deep down&#8221; in your application you do not have to start from the beginning again. Attach to process lets you [...]]]></description>
			<content:encoded><![CDATA[<p>When i debug web applications i like to go with the <strong>attach to process</strong> instead of pressing F5 when i use IIS as the development web server. It has lot of advantages:</p>
<ul>
<li>If you are &#8220;deep down&#8221; in your application you do not have to start from the beginning again. Attach to process lets you debug the tab/window you already using.</li>
<li>When you &#8220;press play&#8221; in VS and have Firefox as the default search engine you Visual Studio opens a new tab each time you start and you end up with X number of tabs with your app.</li>
<li>Probably more that i can&#8217;t think of right now.</li>
</ul>
<p>Anyway the big disadvantage with this is that it is a pretty tedious process to attach to a process.</p>
<ul>
<li>Press <strong><em>ctrl-alt-p</em></strong> to bring up the attach to process dialog.</li>
<li>Scroll down to w3wp.exe and &#8220;attach&#8221; it. For some reason it doesn&#8217;t work to press &#8220;w&#8221; here either so you have to scroll down manually.</li>
<li>Click ok and then you have to confirm that you really have to do it.</li>
</ul>
<p>I have been doing this for months but today i decided to see if Google had any answer to my problem and surely it did. I found <a href="http://stackoverflow.com/questions/894848/how-can-i-attach-to-a-process-in-visual-studio">this question</a> on Stackoverflow. The answer to the question was to record a macro in Visual Studio that do this for you.</p>
<ul>
<li>Press <strong><em>ctrl-shift-r</em></strong> to start record the Macro.</li>
<li>Do the steps i described above to attach to the process.</li>
<li>Press <strong><em>ctrl-shift-r</em></strong> again to stop the recording.</li>
</ul>
<p>Now you have the attach to process as a temporary macro and can run it with <strong><em>ctrl-shift-p</em></strong>. You will get an error if you try to run it when you already attach to a process and so on but it work. If you want to you can look for the error 0x8971001E and add DTE.Debugger.Stop(True) in the catch part of the macro.</p>
<p>You can also save the macro and add it to your toolbar, attach your own keyboard shortcut to it and so on. Check out <a href="http://www.switchonthecode.com/tutorials/how-to-configure-and-use-visual-studio-macros">this article about macros</a> on &#8220;Switch on the code&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://codepolice.net/2009/09/01/quick-attach-to-process-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->