<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Hadi Hariri : Tools</title><link>http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx</link><description>Tags: Tools</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Providing Intellisense, Navigation and more for Custom Helpers in ASP.NET MVC</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2011/12/07/providing-intellisense-navigation-and-more-for-custom-helpers-in-asp-net-mvc.aspx</link><pubDate>Wed, 07 Dec 2011 13:47:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:68809</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>19</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=68809</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2011/12/07/providing-intellisense-navigation-and-more-for-custom-helpers-in-asp-net-mvc.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You probably are aware by now that as of ReSharper 5 we added first-class support for ASP.NET MVC. This included among many things, the ability to provide Intellisense, Create from usage and Navigation to built-in methods such as &lt;i&gt;Controller.View &lt;/i&gt;or &lt;i&gt;Html.ActionLink&lt;/i&gt;:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Navigation&lt;/h4&gt;
&lt;p&gt;Ctrl+Left Mouse Click or F12 will navigate to the corresponding View&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_0D6522DB.png" border="0" height="257" width="567" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;or to the Action and/or Controller&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_27C515F2.png" border="0" height="130" width="650" /&gt;&lt;/p&gt;
&lt;h4&gt;Intellisense and Create From Usage&lt;/h4&gt;
&lt;p&gt;Ability to have Intellisense when providing Actions/Controllers &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2A8ACAE5.png" border="0" height="98" width="600" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;as well as the possibility of creating from usage&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_709B87F8.png" border="0" height="208" width="729" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, what happens when you want to use a custom function, for instance, a better ActionLink or your own View method? Did you know that you can still get all these goodies? All you need to do is use some Annotations.&lt;/p&gt;
&lt;h3&gt;Using JetBrains.Annotations&lt;/h3&gt;
&lt;p&gt;ReSharper uses annotations via the form of .NET attributes to figure out what an ASP.NET MVC View, Action or Controller is. As such, all we need to do for our custom method and extensions to leverage this, is tell ReSharper what parameter corresponds to what. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Referencing the annotations&lt;/h4&gt;
&lt;p&gt;To use ReSharper annotations, we have mainly two options (with a third one hopefully coming soon):&lt;/p&gt;
&lt;p&gt;1. We can include the library JetBrains.Annotations.dll in our project and reference it.&lt;/p&gt;
&lt;p&gt;2. We can copy the annotations and include it as source in our project&lt;/p&gt;
&lt;p&gt;&lt;i&gt;[3. We can use nuget install-package JetBrains.Annotations] Coming soon!&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The first option is pretty simple. The DLL is located in the ReSharper installation &lt;i&gt;bin &lt;/i&gt;folder. For the second option, we open up &lt;b&gt;ReSharper | Options &lt;/b&gt;and select &lt;b&gt;Code Annotations&lt;/b&gt; entry&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7D293514.png" border="0" height="448" width="583" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;select the &lt;b&gt;Copy default implementation to clipboard &lt;/b&gt;button and paste into an empty file. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Annotating custom methods&lt;/h4&gt;
&lt;p&gt;Once we&amp;rsquo;ve completed this step, all we need to do is annotate our parameters with the correct attributes. We&amp;rsquo;re interested in 3 different attributes in particular:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;AspMvcView&lt;/b&gt; which indicates the parameter is a View &lt;/li&gt;
&lt;li&gt;&lt;b&gt;AspMvcAction&lt;/b&gt; which indicates the parameter is an Action &lt;/li&gt;
&lt;li&gt;&lt;b&gt;AspMvcController&lt;/b&gt; which indicates the parameter is a Controller &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here is the header corresponding to a base controller with a custom method named &lt;i&gt;ExtendedView &lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_46D80D05.png" border="0" height="117" width="345" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and here&amp;rsquo;s the header for a custom ActionLink &lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_21DA4C8C.png" border="0" height="185" width="660" /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;(the body of both methods are omitted and are not necessary to demonstrate the functionality)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As soon as we do this, ReSharper picks up these methods and offers us the same functionality that is provided for the methods that ship out of the box:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_64D61AF9.png" border="0" height="158" width="642" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Notice how we still get Navigation (the underlining), Intellisense and Create from usage in our &lt;i&gt;TheOnlyActionLink &lt;/i&gt;custom method. Its much the same for the &lt;i&gt;ExtendedView &lt;/i&gt;method&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_3199E190.png" border="0" height="128" width="501" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all there is to it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=68809" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category></item><item><title>Setting up TeamCity as a native NuGet Server</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2011/12/01/setting-up-teamcity-as-a-native-nuget-server.aspx</link><pubDate>Thu, 01 Dec 2011 16:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:68448</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>18</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=68448</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2011/12/01/setting-up-teamcity-as-a-native-nuget-server.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.jetbrains.com/teamcity/2011/11/24/new-teamcity-7-0-eap-build-20702/"&gt;TeamCity 7.0 EAP (Early Access Program) was recently opened&lt;/a&gt; and one of the new features is the built-in support for NuGet. I recently blogged about setting up &lt;a href="http://blogs.jetbrains.com/dotnet/2011/08/native-nuget-support-in-teamcity/"&gt;TeamCity to pack and publish NuGet packages via a plug-in&lt;/a&gt; and this plug-in is now included by default in TeamCity 7. However, the real new interesting feature is that TeamCity is now a native NuGet repository too! &lt;/p&gt;
&lt;h3&gt;Native NuGet Server? &lt;/h3&gt;
&lt;p&gt;Many of those that have been using NuGet, have most likely been using it to consume packages from nuget.org where there are currently over 3800 unique packages, most of which are open source. &lt;/p&gt;
&lt;p align="center"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_12197754.png" border="0" height="138" width="483" /&gt;&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="justify"&gt;What happens however if for some reason or another you do not want to submit packages to nuget.org? For instance, think that you want to use NuGet to modularize and distribute code inside your own organization, or create libraries for private consumption. In this case, publishing to nuget.org does not make sense. This leaves you with basically two options:&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;div align="justify"&gt;Setup your own NuGet repository by downloading and installing the code that nuget.org for instance&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;Copy nuget packages to a local share and have everyone read off of that&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="justify"&gt;Both of these options come with their own share of overhead. With the local share you now require sharing of folders and permissions. Setting up your own NuGet repository also requires managing permissions and whatnot separately. At the end of the day, its another service to manage. &lt;/p&gt;
&lt;p align="justify"&gt;Fortunately, you now have a third option: TeamCity. The same server that builds your projects, runs your tests, packs and publishes your packages can now also serve them. The best part of it is that it is so simple, that I had to take up the rest of this blog with the previous nonsense just to give it some meat. &lt;/p&gt;
&lt;h3 align="justify"&gt;Enabling TeamCity as a NuGet Server&lt;/h3&gt;
&lt;p align="justify"&gt;I am not going to cover how to pack and publish packages in this post. All that is covered in detail in the &lt;a href="http://blogs.jetbrains.com/dotnet/2011/08/native-nuget-support-in-teamcity/"&gt;previous post&lt;/a&gt; I wrote, so please read that first if you&amp;rsquo;re not familiar with the process. Enabling TeamCity as NuGet and making packages available consists of two steps:&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4 align="justify"&gt;1. Enable the server to be a NuGet server&lt;/h4&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="justify"&gt;Go to &lt;b&gt;Administration | Server Configuration | NuGet&lt;/b&gt; tab&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_1787E7F8.png" border="0" height="306" width="679" /&gt;&lt;/p&gt;
&lt;p align="justify"&gt;Click on the &lt;b&gt;Enable&lt;/b&gt; button to enable it. The same screen with then display two different feeds: a public and a private one:&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="justify"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2F3F1F5E.png" border="0" height="269" width="628" /&gt;&lt;/p&gt;
&lt;p&gt;If by chance the Public Url is not available, you will probably see a message telling you that you &lt;b&gt;need to enable the Guest account in TeamCity&lt;/b&gt;, which can be done from the General tab.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;2. Make your packages be your Artifacts&lt;/h4&gt;
&lt;p&gt;Since TeamCity itself is going to be a NuGet server, the step to publish a package is no longer required. However, packing the package is. In this step (&lt;b&gt;NuGet Pack Build Type&lt;/b&gt;), we can just configure the output for the package to point to some specific folder, for instance &lt;i&gt;packages&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_22D0FC35.png" border="0" height="123" width="885" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We need instruct TeamCity to ouput the results of this folder as artifacts. This is done in the &lt;b&gt;General Settings&lt;/b&gt; step of the Build Configuration&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4CD0FA5D.png" border="0" height="200" width="752" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and with that, we&amp;rsquo;re done. Next up is to configure Visual Studio to consume from this feed.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Configuring Visual Studio&lt;/h3&gt;
&lt;p&gt;Although this step is optional, it is recommended to add your repositories to Visual Studio to avoid having to type long URL&amp;rsquo;s in each time you want to read from a specific package repository. To do this, click on &lt;b&gt;Options | Library Package Manager | Package Manager Settings&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4B8C617E.png" border="0" height="420" width="617" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We need to add a new NuGet Repository. I&amp;rsquo;ve called it &lt;i&gt;Local TeamCity&lt;/i&gt;&amp;nbsp; and the URL corresponds to the public URL provided to me by TeamCity in Step 1:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_581A0E9A.png" border="0" height="384" width="479" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Notice that I have another entry which is &lt;i&gt;Local TeamCity Auth &lt;/i&gt;which corresponds to the authenticated version. &lt;/p&gt;
&lt;p&gt;Once we have this, we can now easily consume packages from our repository by merely specifying it in the Package Manager Console, either via the Combobox or explicitly in each call:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_56D575BB.png" border="0" height="161" width="743" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;That&amp;rsquo;s all there is to it. By merely publishing our packages as artifacts, TeamCity now provides a full-fledged nuget server which opens up great possibilities when it comes to working and managing dependencies between projects. TeamCity is currently in EAP and much of what I&amp;rsquo;ve described here is in open to improvements. That is why your feedback is very important. &lt;a href="http://confluence.jetbrains.net/display/TW/TeamCity+EAP"&gt;Download 7 and start playing with it today&lt;/a&gt;. Let us know what you think. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=68448" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/TeamCity/default.aspx">TeamCity</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/NuGet/default.aspx">NuGet</category></item><item><title>Native NuGet Support in TeamCity</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2011/08/24/native-nuget-support-in-teamcity.aspx</link><pubDate>Wed, 24 Aug 2011 20:01:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:68133</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>26</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=68133</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2011/08/24/native-nuget-support-in-teamcity.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A few months ago, &lt;a href="http://twitter.com/shanselman"&gt;Scott Hanselman&lt;/a&gt; gave a session at TechEd US were he showed some new features we were working on for TeamCity, in order to provide first class support for NuGet. He later &lt;a href="http://www.hanselman.com/blog/NuGetForTheEnterpriseNuGetInAContinuousIntegrationAutomatedBuildSystem.aspx"&gt;blogged about it here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Instead of delaying until the next release of TeamCity, this feature (like many), has been developed as a plug-in. &lt;a href="http://twitter.com/jonnyzzz"&gt;Eugene&lt;/a&gt;, who has been working on it, announced the availability of a first build a few weeks ago. After some initial trials and changes, I decided to setup &lt;a href="http://github.com/JetBrains/YouTrackSharp"&gt;YouTrackSharp&lt;/a&gt; to automate the publishing of the NuGet package. It was surprisingly easy as you&amp;#39;ll see.&lt;/p&gt;
&lt;h3&gt;1. Installing the Plug-in&lt;/h3&gt;
&lt;p&gt;If your project is running on &lt;a href="http://teamcity.codebetter.com"&gt;TeamCity at Codebetter.com&lt;/a&gt;, you can skip to Step 3, since it&amp;#39;s already installed and configured. If not, then grab the &lt;a href="http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt324&amp;amp;tab=buildTypeStatusDiv"&gt;latest build from our public TeamCity server&lt;/a&gt;. Place the zip file into the plugins folder of your TeamCity installation and restart the server.&lt;/p&gt;
&lt;h3&gt;2. Configuring the NuGet version&lt;/h3&gt;
&lt;p&gt;Once the server is running, and agents updated (automated procedure), you then need to tell TeamCity what NuGet version you want to use. The plug-in knows about the nuget.org feed to it can grab the latest version of the command line tool directly. Click on &lt;b&gt;Administration | Server Configuration&lt;/b&gt;. If the plug-in installed correctly, you should now have a new Tab called NuGet:&lt;/p&gt;
&lt;p&gt;&lt;img title="AdminPanelNuGet.png" alt="AdminPanelNuGet" src="http://blogs.jetbrains.com/dotnet/wp-content/uploads/2011/08/adminpanelnuget.png" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;Click on the &amp;quot;Install additional versions of the NuGet.exe Command Line&amp;quot;. TeamCity will read from the feed and display available versions to you in the dialog box. Select the version you want and click Install:&lt;/p&gt;
&lt;p&gt;&lt;img title="NuGetVersion.png" alt="NuGetVersion" src="http://blogs.jetbrains.com/dotnet/wp-content/uploads/2011/08/nugetversion.png" border="0" /&gt;&lt;/p&gt;
&lt;h3&gt;Pull, Pack, Publish&lt;/h3&gt;
&lt;p&gt;The plug-in offers three main operations:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Pulling NuGet packages required to build your project &lt;/li&gt;
&lt;li&gt;Creating NuGet packages &lt;/li&gt;
&lt;li&gt;Publishing Packages &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In my case, I want to create the package and publish it. To give you a general idea of my build process, here&amp;#39;s the outline of the build steps:&lt;/p&gt;
&lt;p&gt;&lt;img title="BuildOverview.png" alt="BuildOverview" src="http://blogs.jetbrains.com/dotnet/wp-content/uploads/2011/08/buildoverview.png" width="600" border="0" height="235" /&gt;&lt;/p&gt;
&lt;p&gt;The NuGet related steps are 3 and 4. Step 1 simply builds the project by building the solution file. Step 2 runs the MSpec tests.&lt;/p&gt;
&lt;h3&gt;3. Building the package&lt;/h3&gt;
&lt;p&gt;This step is for building the actual package. We create a new Build Step in our project and select &lt;b&gt;NuGet Packages Pack&lt;/b&gt;. This will give us the following configuration screen:&lt;/p&gt;
&lt;p&gt;&lt;img title="Step3.png" alt="Step3" src="http://blogs.jetbrains.com/dotnet/wp-content/uploads/2011/08/step3.png" width="600" border="0" height="460" /&gt;&lt;/p&gt;
&lt;p&gt;As you can see, the configuration is pretty straightforward. Notice that in the Specification file, we can also provide a &lt;i&gt;csproj&lt;/i&gt; file as opposed to a NuGet spec file. The advantage to this is that we do not have to redefine information such as version number and copyright information in the spec file. If you&amp;#39;re not familiar with this feature, check out &lt;a href="http://blog.davidebbo.com/2011/04/easy-way-to-publish-nuget-packages-with.html"&gt;David Ebbo&amp;#39;s post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve also checked the option to &lt;b&gt;Include Sources and Symbols&lt;/b&gt;. This is also explained in David Ebbo&amp;#39;s post and it&amp;#39;s for publishing the sources to &lt;a href="http://symbolsource.org"&gt;Symbolsource&lt;/a&gt;. Additional command line parameters (if required) can be passed in the &lt;b&gt;Additional Commandline arguments&lt;/b&gt;. If you want to make this a release build, you can also do this by defining &lt;b&gt;Configuration=Release&lt;/b&gt; in the &lt;b&gt;Properties&lt;/b&gt; field.&lt;/p&gt;
&lt;p&gt;Finally I&amp;#39;ve specified the Build number of the package using the TeamCity variable %build.number% which auto increments on each build, and is also used by another feature of TeamCity new in 6.5 which is called the AssemblyPatcher, which I&amp;#39;ll show you as the last step.&lt;/p&gt;
&lt;h3&gt;4. Publishing the package&lt;/h3&gt;
&lt;p&gt;The next step is to publish the package. As before, we need to add a Build Step and select &lt;b&gt;NuGet Packages Publish&lt;/b&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img title="BuildStep4.png" alt="BuildStep4" src="http://blogs.jetbrains.com/dotnet/wp-content/uploads/2011/08/buildstep4.png" width="600" border="0" height="374" /&gt;&lt;/p&gt;
&lt;p&gt;This step is even easier to configure. By convention it uses nuget.org as the destination to publish the package. If you have your own NuGet server then fill in the address in the &lt;b&gt;Packages Sources&lt;/b&gt; field. If you&amp;#39;re using nuget.org, leave it blank. You need to provide your API key which is stored in a password protected field and finally indicate which packages you want published. Here you can list each package individually or use wildcards. [Note: relative paths are allowed but at the time of writing this post, there was an issue and I was using the full path. This should be fixed soon].&lt;/p&gt;
&lt;p&gt;If you want to publish to multiple sources, all you need to do is add another step. Note however that we did not have to specify an extra step to publish the sources to symbolsource.org. TeamCity will follow NuGet&amp;#39;s convention and do this for you automatically.&lt;/p&gt;
&lt;h3&gt;5. AssemblyInfo Patcher&lt;/h3&gt;
&lt;p&gt;Although this step is optional I recommend you use it. The AssemblyInfo Patcher is a new Build Feature added to TeamCity which temporarily patches all your projects AssemblyInfo.cs files to update the version number, and then reverts it back after the build is complete. This allows your build number, artifacts, packages and assemblies to all have the same version number. Adding this option is as simple as selecting it from the main project configuration screen:&lt;/p&gt;
&lt;p&gt;&lt;img title="AssemblyPatcher.png" alt="AssemblyPatcher" src="http://blogs.jetbrains.com/dotnet/wp-content/uploads/2011/08/assemblypatcher.png" width="600" border="0" height="164" /&gt;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s it. There&amp;#39;s nothing more to it. With a few simple build steps we have now fully automated packaging and publishing NuGet packages. As I mentioned initially, if you&amp;#39;ve got your project on CodeBetter, you already have this feature enabled. If you&amp;#39;re running your own server, just download the plugin and set it up. It&amp;#39;s very simple.&lt;/p&gt;
&lt;p&gt;Try it out and please give us your feedback!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=68133" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/TeamCity/default.aspx">TeamCity</category></item><item><title>YouTrackSharp and YouTrackForReSharper on JetBrains GitHub</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2011/08/17/youtracksharp-and-youtrackforresharper-on-jetbrains-github.aspx</link><pubDate>Wed, 17 Aug 2011 14:38:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:68115</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=68115</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2011/08/17/youtracksharp-and-youtrackforresharper-on-jetbrains-github.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just a quick note to say that I&amp;rsquo;ve transferred the YouTrackSharp project from my own account over to the &lt;a href="http://github.com/JetBrains"&gt;JetBrains account on github&lt;/a&gt;. I&amp;rsquo;ve also pushed the initial spike of &lt;a href="http://github.com/JetBrains/YouTrackForReSharper"&gt;YouTrackForReSharper&lt;/a&gt; which is a plug-in for &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt; to talk to YouTrack. We&amp;rsquo;re looking for contributors for this project, so if you&amp;rsquo;re up to it, fork away!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=68115" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category></item><item><title>Machine.Specifications for ReSharper 6 now available</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2011/07/20/machine-specifications-for-resharper-6-now-available.aspx</link><pubDate>Wed, 20 Jul 2011 14:16:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:68008</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=68008</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2011/07/20/machine-specifications-for-resharper-6-now-available.aspx#comments</comments><description>&lt;p&gt;Many, myself included, have been eagerly awaiting the release of the ReSharper Runner of Machine.Specification (MSpec) for ReSharper 6. I&amp;rsquo;m glad to announce that this is now available, which is the result of a team-effort between &lt;a href="http://twitter.com/kropp"&gt;Victor Kropp&lt;/a&gt;, &lt;a href="http://twitter.com/#!/lucisferre"&gt;Chris Nicola&lt;/a&gt;, myself and of course &lt;a href="http://twitter.com/#!/agross"&gt;Alexander Gross&lt;/a&gt;, long-time contributor and main maintainer of the MSpec project. &lt;/p&gt;
&lt;p&gt;NuGet packages have already been updated to support ReSharper 6. The source code can also be obtained via &lt;a href="http://www.symbolsource.org/"&gt;SymbolSource.org&lt;/a&gt; if using NuGet or directly from &lt;a href="https://github.com/agross/machine.specifications"&gt;Alexander&amp;rsquo;s GitHub account&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML5fd19d5_5F00_5FA3ABE7.png"&gt;&lt;img style="background-image:none;border-right-width:0px;margin:10px 0px 0px;padding-left:0px;padding-right:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;" title="SNAGHTML5fd19d5" alt="SNAGHTML5fd19d5" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML5fd19d5_5F00_thumb_5F00_03102A80.png" border="0" height="324" width="753" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Installing the Runner in ReSharper 6&lt;/p&gt;
&lt;p&gt;If you&amp;rsquo;re new to MSpec or have simply forgotten how to install the runner under ReSharper, here are some simple steps to use Mspec in your project and integrate it with ReSharper:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;1&lt;/b&gt;. Run the command &lt;i&gt;install-package&lt;/i&gt; &lt;b&gt;Machine.Specifications &lt;/b&gt;(or &lt;b&gt;Machine.Specifications-Signed&lt;/b&gt; if you want the signed version). If this is an existing project, issue the command &lt;i&gt;update-package &lt;/i&gt;instead of &lt;i&gt;install-package&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;2&lt;/b&gt;. Inside the packages folder corresponding to Machine.Specifications, a &lt;i&gt;tools&lt;/i&gt; folder is created with a series of assemblies and some batch files. There are a series of batch files named InstallResharperRunner.X.X. &amp;ndash; VS20XX.bat where X&amp;rsquo;s correspond to the version of ReSharper and of Visual Studio. By executing the corresponding one, it will copy the assemblies to the ReSharper plug-in folder. &lt;/p&gt;
&lt;p&gt;You can of course do the second step manually, by copying the Machine.Specifications.ReSharperRunner.X.Y files to the ReSharper Plugins folder, located either under the ReSharper bin folder in %Program Files%\JetBrains\ReSharperX\bin (for all users) or under %APPDATA%\JetBrains\ReSharperX\bin (user-specific settings).&lt;/p&gt;
&lt;p&gt;With that you should be up and running.&lt;/p&gt;
&lt;p&gt;Enjoy.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=68008" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/MSpec/default.aspx">MSpec</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Testing/default.aspx">Testing</category></item><item><title>Coverage with TeamCity and dotCover with MSTest, NUnit or MSpec</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/12/10/coverage-with-teamcity-and-dotcover-with-mstest-nunit-or-mspec.aspx</link><pubDate>Fri, 10 Dec 2010 11:26:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:63891</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>17</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=63891</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/12/10/coverage-with-teamcity-and-dotcover-with-mstest-nunit-or-mspec.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As some of you know, we recently shipped &lt;a href="http://www.jetbrains.com/teamcity"&gt;TeamCity&lt;/a&gt; 6 which includes, out of the box, a bundled version of &lt;a href="http://www.jetbrains.com/dotcover"&gt;dotCover&lt;/a&gt;. What this means is that you can now get coverage reports for your code easily, and of course, for free if you&amp;rsquo;re using the Professional version of &lt;a href="http://www.jetbrains.com/teamcity"&gt;TeamCity&lt;/a&gt;.&amp;nbsp; The setup is quite easy if you are using MSTest and NUnit. For MSpec, you need to take a few additional steps.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Using MSTest / NUnit Runners&lt;/h3&gt;
&lt;p&gt;Normally build files consist of a series of tasks that involve compilation and running of tests. With TeamCity, you can separate some of these steps out into individual TeamCity Build steps, which is what we will be doing in this case (everything that we see here applies to both MSTest and NUnit). &lt;/p&gt;
&lt;p&gt;Here is our build.xml (MSBuild) file:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4AF768D1.png"&gt;&lt;img height="133" width="646" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_63A69014.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;As we can see, other than compiling a solution, which in this case consists of the actual application and the test assemblies, not much else going on. &lt;/p&gt;
&lt;p&gt;[Note: this could have been done using the SLN as the Runner Type under TeamCity since this example build script does not do much else. In real scenarios however, build scripts do more than just call a solution (in fact normally you&amp;rsquo;d call projects not solutions)]. &lt;/p&gt;
&lt;p&gt;In TeamCity, we create a new build project and setup the VCS root. We then add a new Build Step which calls this MSBuild file:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_534B185B.png"&gt;&lt;img height="499" width="642" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_61C61480.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Notice that all we are doing here is calling our MSBuild script. No coverage settings yet. &lt;/p&gt;
&lt;p&gt;Next thing is to add an additional build step in TeamCity. This time, we are going to call MSTest as opposed to MSBuild:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML1e386e79_5F00_2B947664.png"&gt;&lt;img height="265" width="664" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML1e386e79_5F00_thumb_5F00_6DD768DA.png" alt="SNAGHTML1e386e79" border="0" title="SNAGHTML1e386e79" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML1e3d642d_5F00_3CF4B16F.png"&gt;&lt;img height="355" width="664" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML1e3d642d_5F00_thumb_5F00_0EBAB5B5.png" alt="SNAGHTML1e3d642d" border="0" title="SNAGHTML1e3d642d" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(the sections cut out are blank). &lt;/p&gt;
&lt;p&gt;In the &lt;strong&gt;.NET Coverage tool &lt;/strong&gt;section we select JetBrains dotCover and then&amp;nbsp; add the assemblies we want coverage for (just the name of the assembly) prefixing them with &lt;strong&gt;+:&lt;/strong&gt; and filtering out those we do not want coverage for with &lt;strong&gt;&amp;ndash;:&lt;/strong&gt;. &lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s all there is to it. Once we run the Build, we should now see a new tab with Coverage Reports as well as a new Artifact which contains the Coverage files zipped up. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4B230492.png"&gt;&lt;img height="227" width="650" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_13F97699.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The Code Coverage tab goes into more detail:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_06B2ED86.png"&gt;&lt;img height="219" width="664" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_3D4098CA.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We can even drill down into individual classes and examine the code coverage:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_45E0F156.png"&gt;&lt;img height="376" width="648" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5770DC21.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;If we are using NUnit instead of MSTest, the only difference is there test runner we select when adding a new Build Step in TeamCity. Instead of MSTest we choose NUnit along with the version:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_3962A860.png"&gt;&lt;img height="284" width="659" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_00F48188.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;What about MSpec or my Specific Test Runner?&lt;/h3&gt;
&lt;p&gt;If we are using MSpec or a different test runner that is not supported directly by TeamCity, we can still get coverage reports; we just need to do a little bit of additional configuration. TeamCity has an API which allows us to send it messages when we want to interact with it (this is actually quite a powerful feature but out of scope for this post so please leave a comment if you&amp;rsquo;d like me to cover it in more detail). We can leverage this API to tell it when to start coverage and where to get the results from. &lt;/p&gt;
&lt;p&gt;Here is the build script for MSpec: &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5D77DD22.png"&gt;&lt;img height="240" width="664" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_20933583.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We have created two targets. The second one (TeamCity) is the one we are interested in. This does a couple of things:&lt;/p&gt;
&lt;p&gt;1. The first &lt;strong&gt;&amp;lt;Exec&amp;gt; &lt;/strong&gt;runs all MSpec tests so that we can see the test results inside TeamCity. This is not strictly necessary for Code Coverage but usually build processes do display these results. The --&lt;strong&gt;teamcity &lt;/strong&gt;option we are passing in to MSpec is for it to generate the system messages that are then fed to TeamCity (see point 3)&lt;/p&gt;
&lt;p&gt;2. The second &lt;strong&gt;&amp;lt;Exec&amp;gt; &lt;/strong&gt;is the one that runs dotCover. This uses a configuration file called dotCover.xml which we will examine further down. We pass in the c (or coverage) option when calling dotCover. &lt;/p&gt;
&lt;p&gt;3. This is a message we send to TeamCity to tell it that we have run coverage. We indicate the tool we are using (&lt;strong&gt;dotcover &lt;/strong&gt;in this case) and where the results are located. TeamCity uses this information to then display the results in the UI. This is one of the API messages mentioned earlier. &lt;/p&gt;
&lt;p&gt;Finally we need to define the dotcover.xml file with out configuration for running dotCover (for detailed information on creating &lt;a href="http://www.jetbrains.com/dotcover"&gt;dotCover&lt;/a&gt; configuration files, see &lt;a href="https://hhariri.wordpress.com/2010/07/28/running-code-coverage-from-the-console-with-dotcover/"&gt;here&lt;/a&gt; and &lt;a href="https://hhariri.wordpress.com/2010/08/05/advanced-scenarios-with-dotcover-console-runner/"&gt;here&lt;/a&gt;):&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7180D3DE.png"&gt;&lt;img height="581" width="673" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_6476CE00.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;In terms of TeamCity, we then just define our build step that calls out to the build script:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7C1DDF99.png"&gt;&lt;img height="472" width="588" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_553FA38C.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Notice how we do not specify &lt;strong&gt;.NET Coverage &lt;/strong&gt;options explicitly. And if all goes well, we can see the coverage output just as before: &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_113BBF75.png"&gt;&lt;img height="296" width="684" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_0793513F.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;We can see that running code coverage is now pretty straightforward when using MSTest, NUnit or even a custom test runner. Most of what we have covered for MSpec will work with pretty much any test runner in terms of coverage (feel free to vote &lt;a href="http://youtrack.jetbrains.net/issue/TW-14864"&gt;here for MSpec support&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;With any build process, there are numerous ways of doing the same thing. I&amp;rsquo;m going to show you one of them. Based on your setup and needs you might want to do things differently. Fortunately TeamCity is flexible enough to allow for many scenarios. &lt;/p&gt;
&lt;p&gt;One thing to be aware of is that dotCover creates some temporary files for the XmlSerailizer in the Temp profile folder. This normally is not a problem unless the folder does not exist. If you are running TeamCity under the SYSTEM account, make sure that the folder C:\Windows\system32\config\systemprofile\AppData\Local\&lt;strong&gt;Temp &lt;/strong&gt;exists. This will probably change in future versions so to avoid any possible issues. &lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=63891" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/MSpec/default.aspx">MSpec</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/dotCover/default.aspx">dotCover</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/TeamCity/default.aspx">TeamCity</category></item><item><title>Writing plug-ins for ReSharper: Part 2 of N</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/07/20/writing-plug-ins-for-resharper-part-2-of-n.aspx</link><pubDate>Tue, 20 Jul 2010 21:02:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:61155</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=61155</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/07/20/writing-plug-ins-for-resharper-part-2-of-n.aspx#comments</comments><description>&lt;p&gt;[Finally I&amp;rsquo;ve managed to get the second part of the post on plug-ins. Sorry for the delay to everyone who was waiting. Appreciate your patience.&amp;nbsp; And now I&amp;rsquo;ll resume my holidays!]&lt;/p&gt;
&lt;p&gt;In the &lt;a href="http://devlicio.us/blogs/hadi_hariri/archive/2010/01/12/writing-plug-ins-for-resharper-part-1-of-undefined.aspx"&gt;previous part of this series&lt;/a&gt;, we saw the basics of how to create a plug-in for &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt;, install it and run it. We created a context action that would allow us to mark a public method as virtual (where applicable). However, this was done as an explicit action by the user, as such, you didn&amp;rsquo;t get any kind of hint or suggestion to do this. What we want to do now is make this a hint, so that highlighting appears under methods that could be made virtual. In this part we are going to expand on the same plug-in and convert it into a &lt;i&gt;QuickFix&lt;/i&gt;. &lt;/p&gt;
&lt;h3&gt;What is a &lt;i&gt;QuickFix?&lt;/i&gt;&lt;/h3&gt;
&lt;p&gt;Have you seen the little squiggly lines that appear in Visual Studio? &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_18E8B29B.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_6EB904B2.png" border="0" height="162" width="326" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;They usually indicate a Suggestion (field can be made read-only), Warning (possible null reference) or Error. ReSharper analyzes and can detect potential issues in the code (similar to what static checker of Code Contracts does). These are known as Highlights and they are related to QuickFixes in that usually a highlight has an &lt;b&gt;QuickFix&lt;/b&gt; associated to it, which invokes a context action. This is usually done by placing the cursor on top of the highlighting and press Alt+Enter&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_76ED2A49.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_09C1ADF4.png" border="0" height="116" width="403" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Highlighting Daemons&lt;/h3&gt;
&lt;p&gt;In the gutter of the Visual Studio editor (right-side), ReSharper displays a series of warnings, errors and hints, which indicate potential issues on a specific file. These issues are detected by background processes known as Daemons. Since what we are looking for is for ReSharper to warn us of existing methods that could be made virtual, what we need to do is somehow hook into these daemons. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_404F5938.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;margin-left:0px;border-left-width:0px;margin-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_37131DF7.png" border="0" height="244" width="65" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Step by Step Guide&lt;/h3&gt;
&lt;p&gt;The Daemons in ReSharper use the Visitor pattern to use act on elements, be it code, files, etc. The first step is to implement an &lt;b&gt;IDaemonStage &lt;/b&gt;interface, which hold metadata about our daemon stage at at the same time acts as a factory for the actual process we are implementing. &lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:862f1f96-7fa7-42fd-b72d-f48172f17579" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background-color:#000000;overflow:auto;padding:2px 5px;white-space:nowrap;"&gt;&lt;span style="color:#ffffff;"&gt;[&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;DaemonStage&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(StagesBefore = &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;[]&amp;nbsp;&amp;nbsp;{ &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;typeof&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;LanguageSpecificDaemonStage&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;) })]&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualDaemonStage&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;: &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IDaemonStage&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IDaemonStageProcess&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; CreateProcess(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IDaemonProcess&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; process, &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;DaemonProcessKind&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; processKind)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualDaemonStageProcess&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(process);&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ErrorStripeRequest&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; NeedsErrorStripe(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IProjectFile&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; projectFile)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ErrorStripeRequest&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;.STRIPE_AND_ERRORS;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;There are two main methods to implement. The &lt;b&gt;CreateProcess &lt;/b&gt;is what creates the actual process for us and the &lt;b&gt;NeedsErrorStrip &lt;/b&gt;which indicates whether this daemon uses the gutter to display strips. The &lt;b&gt;DaemonProcessKind&lt;/b&gt; parameter passed into the first method helps us discriminate on when this process should be executed, i.e. only during checking of visible (current) document, during solution wide analysis, etc.&lt;/p&gt;
&lt;p&gt;The next step is to implement the process via the &lt;b&gt;IDaemonStageProcess &lt;/b&gt;interface:&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:41371a43-10bb-4def-b308-70fb9a66784d" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background-color:#000000;overflow:auto;padding:2px 5px;white-space:nowrap;"&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualDaemonStageProcess&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IDaemonStageProcess&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;readonly&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IDaemonProcess&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; _process;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; MakeMethodVirtualDaemonStageProcess(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IDaemonProcess&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; process)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;_process = process;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;void&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; Execute(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;DaemonStageResult&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;gt; commiter)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; (_process.InterruptFlag)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; file = _process.ProjectFile.GetPsiFile(&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;CSharpLanguageService&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;.CSHARP) &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;as&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ICSharpFile&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; (file != &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; highlights = &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;List&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;HighlightingInfo&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;gt;();&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; processor = &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;RecursiveElementProcessor&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IMethodDeclaration&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;gt;(declaration =&amp;gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; accessRights = declaration.GetAccessRights();&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; (accessRights == &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;AccessRights&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;.PUBLIC &amp;amp;&amp;amp; !declaration.IsStatic &amp;amp;&amp;amp; !declaration.IsVirtual &amp;amp;&amp;amp;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;!declaration.IsOverride)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; docRange = declaration.GetNameDocumentRange();&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;highlights.Add(&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;HighlightingInfo&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(docRange, &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualSuggestion&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(declaration)));&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;});&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;file.ProcessDescendants(processor);&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;commiter(&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;DaemonStageResult&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(highlights));&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The main meat of this class is in the &lt;b&gt;Execute &lt;/b&gt;method. We first check to make sure that we&amp;rsquo;ve not received an interruption (Interrupt Flag raised) due to some external action. Next step is to get access to the current file (remember that we are visiting the entire visible document, not just a specific method). Having the file, we can now create a &lt;b&gt;RecusiveElementProcessor*&lt;/b&gt; to perform a tree walk of the AST and perform the specific action on each element. The action to perform is declared as the lambda expression. Since we&amp;rsquo;re interested in the method declaration, the type is &lt;b&gt;IMethodDeclaration&lt;/b&gt; (there are many others). If we look at the expression, we can see that it&amp;rsquo;s pretty much the same as that of &lt;a href="http://hadihariri.com/blogengine/post/2010/01/12/Writing-plug-ins-for-ReSharper-Part-1-of-Undefined.aspx"&gt;Part 1&lt;/a&gt;, the only difference is that we add the results to the highlighting variable. &lt;/p&gt;
&lt;p&gt;The &lt;b&gt;HighlightingInfo &lt;/b&gt;class has a parameter which can be a Suggestion, Warning or Error, as explained previously. Since in our case we need a suggestion, we pass in the &lt;b&gt;MakeMethodVirtualSuggestion&lt;/b&gt;:&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:781a1c96-7177-497a-94aa-8aca6403e14a" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background-color:#000000;overflow:auto;padding:2px 5px;white-space:nowrap;"&gt;&lt;span style="color:#ffffff;"&gt;[&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;StaticSeverityHighlighting&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;Severity&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;.SUGGESTION)]&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualSuggestion&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;CSharpHighlightingBase&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IHighlighting&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ICSharpTypeMemberDeclaration&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; Declaration { &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;private&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;set&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; }&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; MakeMethodVirtualSuggestion(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ICSharpTypeMemberDeclaration&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; memberDeclaration)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;Declaration = memberDeclaration;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; ToolTip&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#a5c25c;"&gt;&amp;quot;Method could be marked as virtual&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; }&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; ErrorStripeToolTip&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; ToolTip; }&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; IsValid()&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; Declaration.IsValid();&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;int&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; NavigationOffsetPatch&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;0&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; }&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This class is pretty simple. The main property to define is the &lt;b&gt;ToolTip&lt;/b&gt;, which is the text that will show when we hover of the highlighting. The &lt;b&gt;ErrorStripeToolTip&lt;/b&gt; is what&amp;rsquo;s displayed in the right-hand side gutter. Finally the Attribute &lt;b&gt;StaticSeverityHighlighting &lt;/b&gt;is to indicate what type of tip it is (Warning, Error, etc.). &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[*Note: In this case, the operation we want to perform is very simple. If we want a more complex scenario where we need to do some processing before and after each element is visited or have a more fine-grained control, we can implement the &lt;b&gt;IRecurisveElementProcessor&lt;/b&gt;. I&amp;rsquo;ll cover this in another post].&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;To recap, right now we would have everything place to display highlighting when a method that could be made virtual is encountered. The only remaining part is to now be able to apply a &lt;b&gt;QuickFix&lt;/b&gt;. This is in many ways similar to the ContextAction we saw in &lt;a href="http://hadihariri.com/blogengine/post/2010/01/12/Writing-plug-ins-for-ReSharper-Part-1-of-Undefined.aspx"&gt;Part 1&lt;/a&gt;:&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9e844366-abb3-4116-887f-dfcbfb826cf0" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background-color:#000000;overflow:auto;padding:2px 5px;white-space:nowrap;"&gt;&lt;span style="color:#ffffff;"&gt;[&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;QuickFix&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;]&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualQuickFix&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IQuickFix&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;readonly&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualSuggestion&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; _highlighter;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#808080;"&gt;// Takes as parameter the Highlighter the quickfix refers to&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; MakeMethodVirtualQuickFix(&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;MakeMethodVirtualSuggestion&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; highlighter)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;_highlighter = highlighter;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#808080;"&gt;// In the transaction we make the necessary changes to the code&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; progress)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;_highlighter.Declaration.SetVirtual(&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;);&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;;&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#808080;"&gt;// Text that appears in the context menu&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; Text&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#a5c25c;"&gt;&amp;quot;Make Method Virtual&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; }&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#808080;"&gt;// Indicates when the option is available &lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; cache)&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; _highlighter.IsValid();&lt;/span&gt;&lt;br /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;b&gt;MakeMethodVirtualQuickFix &lt;/b&gt;needs to implement the &lt;b&gt;IBulbItem &lt;/b&gt;and &lt;b&gt;IQuickFix &lt;/b&gt;interfaces. For ease of implementation we can inherit from &lt;b&gt;BulbItemImpl&lt;/b&gt;. The constructor should take as parameter always the actual highlighting that has given way to invoking the QuickFix, in our case the &lt;b&gt;MakeMethodVirtualSuggestion&lt;/b&gt;. Similar to the ContextAction we implemented in &lt;a href="http://hadihariri.com/blogengine/post/2010/01/12/Writing-plug-ins-for-ReSharper-Part-1-of-Undefined.aspx"&gt;Part 1&lt;/a&gt;, the actual fix itself is pretty trivial. All we need to do is make the method virtual. How do we get access to the method? The easiest way is via the Declaration property of the highlighting passed in (this is a property we added before). The only thing left is to call the &lt;b&gt;SetVirtual &lt;/b&gt;method on it. Since we are in the &lt;b&gt;ExecuteTransaction &lt;/b&gt;method, ReSharper makes sure that any change made is executed as a whole. &lt;/p&gt;
&lt;p&gt;The rest of the properties are trivial. Text returns the text of the QuickFix (what appears in the menu), and &lt;b&gt;IsAvailable&lt;/b&gt; indicates when the &lt;b&gt;QuickFix&lt;/b&gt; is available, which in our case is whenever the highlighting is valid. &lt;/p&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;The End Result&lt;/h3&gt;
&lt;p&gt;Once we compile the plug-in and place it in the corresponding Plugins folder under ReSharper\Bin, we&amp;rsquo;re done. Here&amp;rsquo;s the end result:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_0E2808EE.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_2168BF8D.png" border="0" height="124" width="400" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;and invoking Alt+Enter on the highlighting gives us:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2A091819.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_479AF318.png" border="0" height="185" width="399" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;Extending ReSharper to create highlightings and quick fixes is pretty simple once you understand how all the pieces fall into place. Most of the code will usually be the same and what will vary will be the actual element processing to be performed and the corresponding QuickFix. As mentioned previously (in the Note), for complex scenarios, we can have more control over the tree walk and that&amp;rsquo;s something we&amp;rsquo;ll examine in a future post.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve placed the code up on my &lt;a href="http://github.com/hhariri"&gt;github account&lt;/a&gt; so feel free to download it, play with it and ping me if you have any comments or questions. The code is updated to work with ReSharper 5.1&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=61155" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category></item><item><title>Show Covering Tests with dotCover</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/07/06/show-covering-tests-with-dotcover.aspx</link><pubDate>Tue, 06 Jul 2010 20:58:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:61003</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>23</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=61003</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/07/06/show-covering-tests-with-dotcover.aspx#comments</comments><description>&lt;p&gt;One of the new features &lt;a href="http://www.jetbrains.com/dotcover"&gt;dotCover&lt;/a&gt; has added is the ability to find tests that cover a certain piece of code. Something remotely similar has been available in &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt;, although it has been kind of an archaic solution (i.e. Find Usages on Method calls, locate Test assemblies in Result window). &lt;/p&gt;
&lt;p&gt;dotCover makes this easier by providing quick access to this information and extends it in functionality. &lt;/p&gt;
&lt;p&gt;Below we can see some tests from an MVC application. Let&amp;rsquo;s run Code Coverage on it using dotCover first. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_58BD7464.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_31DF3857.png" width="594" border="0" height="282" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now let&amp;rsquo;s switch over to the Source Code and select some random source code, in this case the &lt;b&gt;MembershipService.ChangePassword &lt;/b&gt;line in the &lt;b&gt;ChangePassword &lt;/b&gt;action:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_0B00FC4A.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_66ABF1FA.png" width="595" border="0" height="270" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order to see the tests that cover this line of code, we can either press the default key combination of Ctrl+Alt+K or select the option &lt;b&gt;Show Covering Tests &lt;/b&gt;from the dotCover:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_238073CD.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7B0191B8.png" width="244" border="0" height="152" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;dotCover will then display a small window showing all the different tests that cover that line of code. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_746E1228.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_438B5ABD.png" width="608" border="0" height="107" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;At this point, we can run the selected tests or add them to the existing ReSharper Test Runner session. This allows us to easily jump from specific sections of code to the corresponding tests and execute them instantly. &lt;/p&gt;
&lt;p&gt;One minor note: The default key mapping conflicts with KeePass, but you can easily re-assign it via Visual Studio Tools | Options | Keyboard, or do as I did and change KeePass to Ctrl+Alt+P (P as in Password&amp;hellip;makes more sense). &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML5841541_5F00_47B53282.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="SNAGHTML5841541" alt="SNAGHTML5841541" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/SNAGHTML5841541_5F00_thumb_5F00_4955D889.png" width="420" border="0" height="245" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=61003" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/dotCover/default.aspx">dotCover</category></item><item><title>Zen Coding and ReSharper PowerToys</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/03/11/zen-coding-and-resharper-powertoys.aspx</link><pubDate>Thu, 11 Mar 2010 11:25:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55858</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>22</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=55858</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/03/11/zen-coding-and-resharper-powertoys.aspx#comments</comments><description>&lt;p&gt;Yesterday the &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt;&amp;nbsp;&lt;a href="http://twitter.com/resharper"&gt;Twitter Account&lt;/a&gt; tweeted about a Zen Coding Plug-in available as a PowerToy. If you&amp;rsquo;re not familiar with Zen Coding, &lt;a href="http://vimeo.com/7405114"&gt;check out this link&lt;/a&gt;. I received a couple of emails from people asking about the PowerToys and what exactly they were, and to be honest, I wasn&amp;rsquo;t really surprised. I don&amp;rsquo;t think many have actually heard of them. So I decided to follow &lt;a href="http://www.hanselman.com/"&gt;Hanselman&amp;rsquo;s&lt;/a&gt; advice of minimizing key strokes, thus the post.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;What are they?&lt;/h4&gt;
&lt;p&gt;The Power Toys are a series of plug-ins that have been written by the ReSharper developer team, and have been used in fact internally as samples of ReSharper&amp;rsquo;s API. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Where can I get them and how do I install them?&lt;/h4&gt;
&lt;p&gt;You can download the PowerToys for ReSharper 5 from the Early Access Program page (for previous versions, see What next?), which is &lt;a href="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+5.0+Nightly+Builds"&gt;here&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_41FBCBC7.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_38AF6AB9.png" border="0" height="272" width="527" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Unless there&amp;rsquo;s some API change, there are normally compatible from one build to the next, but just to be safe, download the one corresponding to the nightly build you have. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_34756D27.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_36EE7918.png" border="0" height="340" width="479" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;They are packaged up in a zip file that contains MSI installers for each individual plug-in, as well as a PowerToys Pack which includes them all (and you can pick and choose which one you want during the installation process). Best option is to just pick the full pack. Each MSI is also suffixed with a version, 8 corresponding to Visual Studio 2005, 9 to 2008 and 10 to 2010. &lt;/p&gt;
&lt;p&gt;The zip file also contains another zip with the source code, which you can compile and install, if you don&amp;rsquo;t want to use an installer. If you&amp;rsquo;re doing this, compile them and place them under the %Program files%\&lt;a href="http://www.jetbrains.com"&gt;JetBrains&lt;/a&gt;\ReSharper\Bin\Plugins folder. Normally best to create a folder for each plug-in (If you&amp;rsquo;re just interested in having the source but prefer to use the MSI, the installer will also install the source for you).&lt;/p&gt;
&lt;p&gt;Once you install them, they should appear as plug-ins under the ReSharper menu:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7D2B9393.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_19D4E2DC.png" border="0" height="350" width="426" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you can see from the list, there are quite a few goodies in there, not only Zen Coding! &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;What next? &lt;/h4&gt;
&lt;p&gt;The PowerToys are not only valuable in terms of the functionality they provide, but also serve as an example of how to write ReSharper plug-ins and interact with the ReSharper API, but they&amp;rsquo;ve never been released passed Early Access Programs. That is one reason 4.5 PowerToys are not available. &lt;/p&gt;
&lt;p&gt;However, we want to change that. We not only want to make them available, but also to document them and offer them as a true OSS project, where the developer community can contribute to them, be it with additional features, bug fixes or providing completely new plug-ins. &lt;/p&gt;
&lt;p&gt;This is something that I personally think would be valuable for the community. If you like this idea or have other suggestions, please feel free to give me feedback. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55858" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category></item><item><title>Profiling Apps 1 of N: The MVC ActionLink</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/03/09/profiling-apps-1-of-n-the-mvc-actionlink.aspx</link><pubDate>Tue, 09 Mar 2010 20:34:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55802</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>31</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=55802</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/03/09/profiling-apps-1-of-n-the-mvc-actionlink.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m starting a new series of blogs posts on profiling, where we&amp;rsquo;ll try and cover common bottlenecks and how to identify them in your applications. However, before delving deeper into the subject, let me make a small but important observation:&lt;/p&gt;
&lt;p align="center"&gt;&lt;i&gt;Your bottleneck is probably not your for loop&lt;/i&gt;&lt;/p&gt;
&lt;p align="left"&gt;Now, replace that &lt;i&gt;for loop &lt;/i&gt;with &lt;i&gt;switch statement&lt;/i&gt;, an older version of some outdated algorithm that you feel needs optimizing, or that retched collection of classes that would perform better if you were using an array to loop through them, and you&amp;rsquo;ll end up with the same observation.&lt;/p&gt;
&lt;h3&gt;Premature Optimization&lt;/h3&gt;
&lt;p align="left"&gt;When dealing with business applications, it is unusual for major performance problems to be pinpointed down to specific portions of code or a concrete implementation of an algorithm. Usually most of the issues are bottlenecks at the data level, network level or purely down to how a business decision is made. &lt;/p&gt;
&lt;p&gt;Whether we use an ORM or use SQL directly, incorrectly formulated queries are one of the most predominant causes of bad performance. Not understanding concepts such as Lazy or Eager loading when using an ORM can be disastrous to the performance of an application, and are usually portrayed as &amp;ldquo;ORM XYZ sucks at performance&amp;rdquo;.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Network bandwidth and latency are other issues; when dealing with web applications for instance, having large pages (i.e. ViewState) or rendering Javascript directly without using script files, are a common problem for performance penalties. Making heavy calls to the server when very little information is required (i.e. UpdatePanel used incorrectly) are again main causes for concern. &lt;/p&gt;
&lt;p&gt;In many cases, design decisions we make early can affect the performance of our applications, and it is important to identify these concerns and address them correctly. Using an ORM, &lt;a href="http://nhprof.com"&gt;profiling it&lt;/a&gt;, understanding how Ajax really works and not worrying about &lt;a href="http://jquery.org"&gt;working with Javascript&lt;/a&gt;, or using an &lt;a href="http://nservicebus.com"&gt;asynchronous architecture&lt;/a&gt; when dealing with long running business processes are many ways to avoid bad performance in the long run. &lt;/p&gt;
&lt;p&gt;On the other hand, what we shouldn&amp;rsquo;t do is focus on micro-optimizations, on trying to make the most efficient, yet completely undecipherable algorithm to calculate the probability of winning money when buying lottery tickets, when the underlying problem is a bottleneck caused by a bad query. This kind of approach is often referred to as Premature Optimization, and can be disastrous for a project. &lt;/p&gt;
&lt;h3&gt;When it does boil down to code&lt;/h3&gt;
&lt;p&gt;Having said all that, there are times when we need better performance after having eliminated all the obvious causes, and need to discover why something is not performing as well as it should be. Of course, these concerns are greater when the nature of our application demands highly optimized code. In these cases, it is crucial to understand how things work in order to solve the problem. As a old-school boy, before we had managed libraries and drag-n-drop, I&amp;rsquo;m also a firm believer that it is always important to understand how things work under the covers, even if it is to just improve one self&amp;#39;s knowledge. &lt;/p&gt;
&lt;p&gt;Therefore, in these series of blog posts about performance, I&amp;rsquo;m going to focus on the latter, examining the details of code and how some things can perform better than others. So given the disclaimer, let&amp;rsquo;s get down to business. &lt;/p&gt;
&lt;p&gt;In order to do performance tuning, you need to use a tool. Setting stopwatches doesn&amp;rsquo;t work, because as &lt;a href="http://www.devspace.com/"&gt;Christian Gross&lt;/a&gt; so rightly pointed out during one of his talks, and I semi-quote: &amp;lsquo;if you&amp;rsquo;re using a stopwatch, you think you know where the bottleneck is. Most of the time, you&amp;rsquo;re wrong&amp;rsquo;.&amp;nbsp; If you are setting using a manual approach of setting calling Start and Stop, trying to time something, you&amp;rsquo;re assuming you know that the performance problem is located in a particular point, and many times it is not that point. So you end up having to place these kind of diagnostic codes in various places in your code, and soon it becomes a maintenance nightmare. Fortunately, there are tools that can profile your application in a non-invasive manner. When talking about SQL profiling, there&amp;rsquo;s &lt;a href="http://nhprof.com"&gt;NHProfiler&lt;/a&gt; for instance. When it comes to code performance profiling, the two most known ones are &lt;a href="http://www.red-gate.com/products/index.htm"&gt;ANT Profiler&lt;/a&gt; and &lt;a href="http://www.jetbrains.com/dottrace"&gt;dotTrace&lt;/a&gt;. I&amp;rsquo;m going to be using dotTrace. I used it before joining &lt;a href="http://www.jetbrains.com"&gt;JetBrains&lt;/a&gt; and continue to use it now that I&amp;rsquo;m at JetBrains. I&amp;rsquo;ll be using &lt;a href="http://www.jetbrains.net/confluence/display/NetProf/4.0+Nightly+Builds"&gt;version 4.0&lt;/a&gt; which is currently (at the time of writing this post), in &lt;a href="http://www.jetbrains.net/confluence/display/NetProf/4.0+Nightly+Builds"&gt;Early Access Program&lt;/a&gt; and with Beta being released very soon. &lt;/p&gt;
&lt;h3&gt;To Express or not Express&lt;/h3&gt;
&lt;p&gt;Those that are familiar with it ASP.NET MVC know it relies heavily on the use of strings in many areas. For instance, when defining ActionLinks, you write&lt;/p&gt;
&lt;p align="center"&gt;Html.ActionLink(&amp;ldquo;Home&amp;rdquo;, &amp;ldquo;Index&amp;rdquo;, &amp;ldquo;Home&amp;rdquo;)&lt;/p&gt;
&lt;p align="left"&gt;where the first parameter is the link text, the second the Action and the third parameter is the Controller. The problem with this of course is that if you type either the second or third parameter incorrectly, you won&amp;rsquo;t know until runtime. Even if you build your views it won&amp;rsquo;t help. &lt;/p&gt;
&lt;p align="left"&gt;An alternative is to use Expression based Html Helpers (&lt;a href="http://hadihariri.com/blogengine/post/2010/01/20/ASPNET-Support-in-ReSharper-5.aspx"&gt;another option&lt;/a&gt; is to use &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt; of course :)). These are strongly-typed ActionLinks that do not ship out of the box with ASP.NET MVC, but are available as a separate download in the &lt;a href="http://aspnet.codeplex.com/releases/view/39978"&gt;MVC Futures&lt;/a&gt; assembly, which can be thought of as a kind of sandbox for Microsoft to play with. Some of the functionalities in this library have eventually made it to the main core, such as &lt;i&gt;RenderPartial&lt;/i&gt;, which was in fact there from pretty much the early Previews of MVC 1, and didn&amp;rsquo;t get all the excitement until it made it into the core in version 2. Other functionality, including the expression based ActionLinks haven&amp;rsquo;t made it in yet. When using these helpers, the previous link would be: &lt;/p&gt;
&lt;p align="center"&gt;Html.ActionLink&amp;lt;HomeController&amp;gt;( a =&amp;gt; a.Index, &amp;ldquo;Home&amp;rdquo;)&lt;/p&gt;
&lt;p align="left"&gt;In principle this looks good, and begs the question of why it is not in the main core. Well I don&amp;rsquo;t know the exact reason, but one could potentially be due to it&amp;rsquo;s performance. Several people have talked about the difference in terms of rendering when using this version as opposed to the standard string based one. You can find one of those &lt;a href="http://codeclimber.net.nz/archive/2009/04/17/the-performances-implications-of-the-expression-tree-based-actionlink-helper.aspx"&gt;posts here&lt;/a&gt;. What I thought I&amp;rsquo;d do, is actually see how much difference in speed there is between one and the other. &lt;/p&gt;
&lt;h3&gt;The Project&lt;/h3&gt;
&lt;p&gt;I&amp;rsquo;m using a very simple project for this profiling. It&amp;rsquo;s your standard ASP.NET MVC 2 application. On Index page, I&amp;rsquo;ve added two blocks of code:&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:23dd89a5-1ba6-4e74-9e95-9d4c09d76120" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#ddd;overflow:auto;"&gt; &lt;ol style="background:#000000;margin:0 0 0 2.5em;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;for&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; (&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;int&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; i = &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;0&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; i &amp;lt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;1000&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; i++)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;%&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;= Html.ActionLink(&lt;/span&gt;&lt;span style="color:#a5c25c;"&gt;&amp;quot;Link &amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; + i, &lt;/span&gt;&lt;span style="color:#a5c25c;"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="color:#a5c25c;"&gt;&amp;quot;Home&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;)&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#e8bc64;"&gt;br&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;&amp;lt;%&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;%&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="color:#cc7832;"&gt;for&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; (&lt;/span&gt;&lt;span style="color:#cc7832;"&gt;int&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; i = &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;0&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; i &amp;lt; &lt;/span&gt;&lt;span style="color:#6897bb;"&gt;1000&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;; i++)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#ffffff;"&gt;{&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;%&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;= Html.ActionLink&amp;lt;&lt;/span&gt;&lt;span style="color:#ffc66d;"&gt;HomeController&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;gt;(a =&amp;gt; a.Index(), &lt;/span&gt;&lt;span style="color:#a5c25c;"&gt;&amp;quot;Link &amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; + i)&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#e8bc64;"&gt;br&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&lt;span style="color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;&amp;lt;%&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#ffffff;"&gt;}&lt;/span&gt;&lt;span style="color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;%&amp;gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt; &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p align="left"&gt;The first &lt;i&gt;for &lt;/i&gt;loop will render out 1000 links using the string based ActionLink version, whereas the second loop will do the same using the expression-based one. &lt;/p&gt;
&lt;p align="left"&gt;What we want to do now is run this and see how long it takes for each loop to complete. &lt;/p&gt;
&lt;h3&gt;Setting up dotTrace Profiler&lt;/h3&gt;
&lt;p&gt;Working with &lt;a href="http://www.jetbrains.com/dottrace"&gt;dotTrace&lt;/a&gt; is as easy as it gets. There are two ways to profile an application: Standalone or integrated within Visual Studio. In the case of the former, you can start up dotTrace outside of Visual Studio and point to an application to profile. On the other hand if you have it integrated inside Visual Studio, then all you need to do is click on the Profile menu option: &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_1B563413.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_4C093BBE.png" border="0" height="150" width="312" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Once we do that, we get a dialog box that provides us a series of options, mainly to do with the type of profiling we are going to perform. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_1E3B72F9.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_4358BD65.png" border="0" height="225" width="330" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Since we&amp;rsquo;re profiling a web application, we can either use the Development Server or Internet Information Server. In our case we&amp;rsquo;re going to use the former. dotTrace will automatically pick up the server settings as well as fill out the physical path for our application. &lt;/p&gt;
&lt;p&gt;Next come the profiling options. The basic settings are Profiling Type and Meter Kind. The first parameter indicates how profiling will take place. It can be:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Sampling: dotTrace will do frequent analysis of calls stacks. It&amp;rsquo;s the least intrusive, has very little impact on performance, but gives approximate timing. &lt;/li&gt;
&lt;li&gt;Tracing: dotTrace receives notifications from the CLR on entry/exit of methods. More precise timing and call information. &lt;/li&gt;
&lt;li&gt;Line-by-Line: dotTrace logs times for every statement in methods. Most precise but also has higher impact on performance. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Tracing is normally the recommended option. Meter Kind defines how dotTrace logs the time: CPU instruction or Performance counter (uses the Windows API and samples are hardware independent). &lt;/p&gt;
&lt;h3&gt;Profiling our application&lt;/h3&gt;
&lt;p&gt;Once we have everything setup, we can start profiling our app. dotTrace will launch a small panel that allows us to control data sampling. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_19954272.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_45D1C956.png" border="0" height="194" width="244" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;dotTrace does not by default however launch the browser. In order to do so, we need to either click on the WebDev server and Open in Browser or just type the URL directly in the browser. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2399BDD0.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_349DEBB3.png" border="0" height="103" width="193" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The next step is to perform the operations we want to profile and then click on GetSnapshot. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_45A21996.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_51C393BD.png" border="0" height="268" width="372" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Since in our case, having rendered the &lt;i&gt;Index &lt;/i&gt;action performs these operations, once the page has been loaded, we can click on GetSnapshot and have the profiler launched. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2F8B8837.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_08AD4C2A.png" border="0" height="293" width="430" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m not going to get into all of the details of dotTrace in this first post because otherwise it would never end;&amp;nbsp; we&amp;rsquo;ll cover some of the aspects in future posts. For now, lets focus on our performance test at hand which is the difference between the two types of ActionLinks (string and expression based). &lt;/p&gt;
&lt;p&gt;The easiest way to find what we are looking for is to use the&amp;hellip;you guessed it, Find feature. Ctrl+F will bring up a dialog box similar to ReSharper&amp;rsquo;s Type location. We can then type ActionLink to filter the list of functions down to the ones that interest us&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_248E5B55.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_54D5300B.png" border="0" height="83" width="467" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We can see that there are two versions, as expected. Let&amp;rsquo;s drill in to the second one first, the string based one. Hitting Enter will find the first location. We can then press F3 until we find the one that interests us. Remember, Site.Master and other references to this call also exist. We&amp;rsquo;re specifically looking for the loop, the one with 1000 calls&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_39502E08.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_00955E2E.png" border="0" height="171" width="546" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We can see that the &lt;i&gt;ActionLink&lt;/i&gt; call takes 121ms for 1000 calls. Drilling in, we can see exactly where the time is spent, and 104ms of that is calling &lt;i&gt;GenerateUrl&lt;/i&gt;. Now let&amp;rsquo;s take a look at the Expression based ActionLink&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_45BD8F8A.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_56B197A0.png" border="0" height="116" width="542" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;For the same 1000 calls it takes 140ms, which is an increase of approximately 17%. Diving in once again, we can see that 6ms of this is in the parsing of the expression tree, &lt;i&gt;GetRouteValuesFromExpression. &lt;/i&gt;What this function does is merely analyze the expression to extract the ActionName from the parameter. The ControllerName it already has since it&amp;rsquo;s the concrete type the generic method is invoked with, returning both values in a &lt;i&gt;RouteValueDictionary&lt;/i&gt;. As such it then needs to call &lt;i&gt;GenerateRouteLink &lt;/i&gt;as opposed to &lt;i&gt;GenerateLink &lt;/i&gt;since the former takes a &lt;i&gt;RouteValueDictionary &lt;/i&gt;as a parameter, whereas the latter takes strings indicating the controller and action. They ultimately both call &lt;i&gt;GenerateUrl&lt;/i&gt;. &lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;From the results, the difference between the two calls is not that significant for 1000 links. As the number of links increment, the difference between the two does not change significantly. For instance, rendering 10.000 links, has a difference of 50ms between one version and another. What&amp;rsquo;s interesting that having run the same profiling on previous
releases, the difference in time was nearly double, so there seems to
have been improvement in this area. And as we can see, sometimes what might seem a performance problem, isn&amp;#39;t necessarily one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55802" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Profiling/default.aspx">Profiling</category></item><item><title>ASP.NET Support in ReSharper 5</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/01/20/asp-net-support-in-resharper-5.aspx</link><pubDate>Wed, 20 Jan 2010 17:04:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55082</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>18</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=55082</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/01/20/asp-net-support-in-resharper-5.aspx#comments</comments><description>&lt;p&gt;Although I mentioned briefly in the past some of the new features ASP.NET MVC features &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt; 5 supports, I thought it would be a good idea to sum up the main ones in a single post and go into a little bit more detail on them. &lt;/p&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;ASP.NET&lt;/h3&gt;
&lt;p&gt;ReSharper &amp;lsquo;s support for ASP.NET is not restricted only to MVC.In fact, most of the new features are for general ASP.NET, be it WebForms (also known as Traditional, Classic, For Historical Purposes Only?) or MVC. &lt;/p&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;Go to File Member&lt;/h4&gt;
&lt;p&gt;As part of the code navigation features of ReSharper, you have the possibility to locate a file member, be it a method, property, class, etc. very easily by using the the &lt;i&gt;Go To File Member&lt;/i&gt; (Alt+\) option. You can search instantly and hit Enter to navigate to the specific one. [For the record, I&amp;rsquo;m using the Visual Studio Keyboard Scheme. If you&amp;rsquo;re using IntelliJ (why?) go to the web site and download the &lt;a href="http://www.jetbrains.com/resharper/documentation/documentation.html"&gt;PDF mapping files&lt;/a&gt;.]&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5EB46561.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_497639EC.png" border="0" height="229" width="447" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Notice how it it looks for anything that matches the characters introduced, so for instance typing &amp;ldquo;Exc&amp;rdquo; would give us all those with the word &amp;ldquo;Exception&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_453C3C5A.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_75831110.png" border="0" height="193" width="452" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Well you now have this functionality in ASPX, ASCX, ASAX and Web.config files also as of ReSharper 5!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4DFC1ED9.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_44BFE398.png" border="0" height="371" width="357" /&gt;&lt;/a&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The same goes for the File Structure tool Window (Ctrl+Alt+F). &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5981B64B.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7EFB0DDF.png" border="0" height="354" width="466" /&gt;&lt;/a&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Go To Related Files&lt;/h4&gt;
&lt;p&gt;Many times, an ASPX has references to other files, such as Cascading Style Sheets, Javascript Files, Master Pages and User Controls. You can now navigate to these files efficiently by using the Go To Related Files (Ctrl+Alt+F7)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5593A014.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_34DCB0A2.png" border="0" height="251" width="669" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Master Pages&lt;/h4&gt;
&lt;p&gt;Version 5 also adds support for Master and Content Pages. To begin with, we have added support for navigation. Using &lt;i&gt;Go To Declaration (&lt;/i&gt;Ctrl+Left Mouse) on the &lt;i&gt;ContentPlaceHolderID&lt;/i&gt; will take you from the Content Form/Page to the corresponding ContentPlaceHolder of the Master Page&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_27F234B7.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5760A383.png" border="0" height="81" width="660" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_49ADE77B.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7341B2AE.png" border="0" height="155" width="662" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;If you are in the Master Page, you can navigate to all its inheritors (Shift+Alt+F12)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7E1E93F6.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_22CFAB6E.png" border="0" height="269" width="459" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;You can also create content place holders from usage. When defining a &lt;i&gt;ContentPlaceHolderID &lt;/i&gt;that does not exist, you have the option to create it in the Master Page (Alt+Enter)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4901DEF9.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_3C2788DB.png" border="0" height="148" width="668" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Last but not least, in a page that uses a master page, you can generate content place holders by pressing Alt+Ins&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_3CD03F05.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5010F5A4.png" border="0" height="250" width="201" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;which in turn will bring up a dialog box for you to pick and choose what you want&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_543ACD69.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_514568B6.png" border="0" height="236" width="425" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;User Controls &lt;/h4&gt;
&lt;p&gt;You can now navigate to user controls as well as automatically import the correct references. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_26A987D9.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_4C33053A.png" border="0" height="187" width="504" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;File Generation&lt;/h4&gt;
&lt;p&gt;There are new code generation options for ASP.NET with version 5. By pressing Alt+Ins in the Solution Explorer, we are presented with a popup menu&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_28B660D5.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_789BE986.png" border="0" height="576" width="311" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;where you can choose from a selection of items to generate. You can also access this menu from anywhere (not only in the Solution Explorer) by now pressing Ctrl+Alt+Ins. This is actually an awesome new addition to ReSharper 5 (Ctrl+Alt+Ins) and it removes even more friction when create new items!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_154538CF.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5A115D03.png" border="0" height="185" width="409" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re asked for a name (which is the base minimum required to create an item) and If the item selected requires more information, then we&amp;rsquo;ll be prompted accordingly. For example, when creating a WebForm with Master Page, it&amp;rsquo;s convenient to specify which Master Page we want to use. In this case, once the page has been created, we&amp;rsquo;ll be given a chance to provide this information&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_220F6920.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_6094B6C6.png" border="0" height="113" width="505" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I have to say, that I love Ctrl+Alt+Ins in ReSharper 5. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Refactoring and Assistance&lt;/h4&gt;
&lt;p&gt;In terms of Refactoring and Coding Assistance there are a few new features. One of them is the auto-update of ending tags. If you have for instance a &lt;i&gt;div&lt;/i&gt; tag, and want to change it to &lt;i&gt;span&lt;/i&gt;, as you start typing &lt;i&gt;span&lt;/i&gt;, the end tag is automatically updated to reflect the changes you&amp;rsquo;re making live. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_04D99B49.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_3A8EE0A3.png" border="0" height="431" width="251" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;If you have a series of elements that you want to surround within a tag, you can easily do this by selecting all the elements and choosing Surround with Template (Ctrl+E,U)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2ABF25D2.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_21EF1D86.png" border="0" height="225" width="365" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_6C95E553.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7D9A1336.png" border="0" height="174" width="131" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_28FE3431.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_079E8E95.png" border="0" height="101" width="369" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;ASP.NET MVC &lt;/h3&gt;
&lt;p&gt;ReSharper 5 treats ASP.NET MVC as a first class citizen. As such, it now has knowledge of concepts such as Views, Controllers and Action. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Navigate to View&lt;/h4&gt;
&lt;p&gt;For those of you working with ASP.NET MVC, you might have noticed that Views are now underlined in Actions&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_77AF49D0.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_043CF6ED.png" border="0" height="118" width="430" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;When you click on the View with Ctrl+Left Mouse, you&amp;rsquo;ll be presented with a dropdown menu&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_6D2E75B0.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_79BC22CC.png" border="0" height="87" width="437" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Here you have two options. The first is to navigate to the source for the &lt;i&gt;View &lt;/i&gt;method (navigation to external sources is another new feature of ReSharper 5). The second option is to go to the View. Although you can navigate to the View in Visual Studio by right-clicking and selecting &lt;i&gt;Go To View&lt;/i&gt;, one advantage the underlining adds is that it serves as hint for non-existent views, as you can see in the action below, which doesn&amp;rsquo;t have a corresponding View file. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_49B1D14B.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5CF287EA.png" border="0" height="118" width="380" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;View discovery also works with named Views. If a named view exists, the string literal will be underlined&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_061A2029.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_64BA7A8C.png" border="0" height="111" width="380" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;On the other hand, if it doesn&amp;rsquo;t exist, it will be highlighted as an error, once again providing you the benefit of discovering any missing views earlier on. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7B994C08.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_485D129F.png" border="0" height="129" width="373" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;Action Links&lt;/h4&gt;
&lt;p&gt;Those of us who have worked with ASP.NET MVC applications, know the problems with using strings when defining ActionLinks. Not only do you run into issues when refactoring, but misspelling an action or controller causes unnecessary pain. Some of us, including myself, have often resorted to using the expression based Actions available in the MVC Futures library. &lt;/p&gt;
&lt;p&gt;ReSharper 5 now provides Intellisense, preventing you from mistyping Actions and Controllers&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_73C13399.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_04592E88.png" border="0" height="143" width="550" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Similar to named Views, if you define a non-existing Action, you will get it highlighted. The difference here is that by pressing Alt+Enter, ReSharper will create the Action for you (create based on usage)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_0163C9D5.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_37854224.png" border="0" height="131" width="550" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_55171D23.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_4CB347CC.png" border="0" height="138" width="549" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And much like Views, you can now navigate to Actions and Controllers from an ActionLink by choosing &lt;i&gt;Go To Declaration &lt;/i&gt;(Ctrl+Left Mouse) on the Action and Controller respectively. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_70F82C4E.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_02F44A0F.png" border="0" height="155" width="554" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;User Controls &lt;/h4&gt;
&lt;p&gt;Navigation is also provided for User Controls&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_78DFA8E3.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_49418A57.png" border="0" height="98" width="476" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;as well as Intellisense&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_019F8B63.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_6371CDAE.png" border="0" height="161" width="475" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;I&amp;rsquo;ve outlined some of the main features that ReSharper 5 brings to the table in regard to ASP.NET. There are many smaller features that you can discover eventually as you play with it more. If you haven&amp;rsquo;t yet, make sure you download 5 from &lt;a href="http://www.jetbrains.com"&gt;JetBrains&lt;/a&gt;. Don&amp;rsquo;t forget to follow &lt;a href="http://twitter.com/resharper"&gt;ReSharper on Twitter&lt;/a&gt; if you want tips, tricks and latest info.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55082" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Writing plug-ins for ReSharper: Part 1 of Undefined</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2010/01/12/writing-plug-ins-for-resharper-part-1-of-undefined.aspx</link><pubDate>Tue, 12 Jan 2010 13:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54980</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>25</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=54980</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2010/01/12/writing-plug-ins-for-resharper-part-1-of-undefined.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt; does a lot of things, but as they say, you can&amp;rsquo;t please &lt;a href="http://twitter.com/mfeathers/status/7406170728"&gt;all the&lt;/a&gt; people all of the time. However, one the great things about ReSharper is that it is quite extensible and there are already quite a number plug-ins available. Some of the better known ones are:&lt;/p&gt;
&lt;p&gt;- &lt;a href="http://stylecopforresharper.codeplex.com"&gt;StyleCop for ReSharper&lt;/a&gt; by &lt;a href="http://howard.vanrooijen.co.uk/blog"&gt;Howard Van Rooijen&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;- &lt;a href="http://code.google.com/p/resharper-tdd-productivity-plugin/"&gt;TDD Productivity Plugin&lt;/a&gt; by &lt;a href="http://www.lostechies.com/blogs/hex/"&gt;Eric Hexter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href="http://github.com/agross/machine.specifications/tree/master/Libraries/ReSharper/"&gt;ReSharper Test Runner&lt;/a&gt; for &lt;a href="http://github.com/machine/machine.specifications"&gt;MSpec&lt;/a&gt; by &lt;a href="http://therightstuff.de/"&gt;Alexander Gro&amp;szlig;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and of course there is also the &lt;a href="http://www.jetbrains.com/resharper/plugins/"&gt;repository of plug-ins available from the JetBrains site&lt;/a&gt;, where many of these are located. &lt;/p&gt;
&lt;p&gt;Now I&amp;rsquo;m no expert on writing plug-ins for ReSharper, and the authors of the previous ones leave the bar quite high, but seeing that I actually now have the time to play with them, I&amp;rsquo;ve decided to do so by sharing my experiences with you in a series of blog posts. &lt;/p&gt;
&lt;p&gt;The ReSharper API is pretty extensive and can be overwhelming as I&amp;rsquo;ve been discovering, so I want to try and take it slowly. This might mean that at times, the code is not always complete and might be missing a few checks for example, but will come in due course. &lt;/p&gt;
&lt;p&gt;Everything that I&amp;rsquo;ll cover applies to &lt;a href="http://www.jetbrains.com/resharper/beta/beta.html"&gt;version 5.0 which is currently in Beta&lt;/a&gt;. There have been some changes from previous versions so if you&amp;rsquo;re working with 4.5 some of the code might not work. &lt;/p&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;The First Plug-in&lt;/h3&gt;
&lt;p&gt;I was initially intending to write a useless plug-in for the first demo that didn&amp;rsquo;t do much, but after talking to &lt;a href="http://twitter.com/orangy/"&gt;Orangy&lt;/a&gt; (aslo known as Ilya) who commented on a tweet Jeremy Skinner had posted a few days back:&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb51" alt="image_thumb51" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb51_5F00_7A64442B.png" border="0" height="238" width="473" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;we decided to use it as the first sample. &lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m going to build up the sample over the next few series of posts, so the initial solution is not the ideal one or complete, but it will help introduce a few core concepts. Ideally this feature should be implemented as what&amp;rsquo;s known as a &lt;i&gt;QuickFix&lt;/i&gt; but we&amp;rsquo;re first going to do it as a &lt;i&gt;ContextAction&lt;/i&gt;. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;ContextAction&lt;/h3&gt;
&lt;p&gt;So what exactly is a Context Action? It&amp;rsquo;s actions that can be applied based on the context (the name is quite descriptive). They shows up as items in a popup menu which is invoked using Alt+Enter (don&amp;rsquo;t use the mouse for this&amp;hellip;it&amp;rsquo;s very unproductive). &lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb4" alt="image_thumb4" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb4_5F00_7C711D27.png" border="0" height="97" width="244" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;What we want to do in this first version of the plug-in is to write a new action that makes methods that are public and not declared virtual, virtual, something NHibernate users would appreciate greatly. As mentioned previously, in this first version we&amp;rsquo;re going to add a context action. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;1. Creating a plug-in assembly&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;ReSharper plug-ins are assemblies that are located in Plugins folder (by default %programFiles%\JetBrains\ReSharper\v5.0\Bin\Plugins). Each plug-in is in it&amp;rsquo;s own folder and doesn&amp;rsquo;t require any further registration. Therefore the first step is to create a class library which will host our context action.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;2. Creating the Context Action Skeleton&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In order to create a context action, we need to implement the &lt;i&gt;IContextAction &lt;/i&gt;interface. This interface has one method &lt;i&gt;IsAvailable&lt;/i&gt; which indicates to us if that particular action is available given the context, and a property of type &lt;i&gt;IBulbItem[]&lt;/i&gt; which contains a series of bulb items. Each &lt;i&gt;IBulbItem&lt;/i&gt; in turn has a property &lt;i&gt;Text&lt;/i&gt; which is the text that appears next to the item in the context dropdown, and an &lt;i&gt;Execute &lt;/i&gt;action, which is what happens when the item is selected. So as we can see, a context action can consist of more than one bulb item. An added benefit to this decoupling is the re-usability of bulb items. By implementing &lt;i&gt;IBulbItem&lt;/i&gt;, we can potentially use it in more than once place (obviously if it makes sense).&lt;/p&gt;
&lt;p&gt;Many times however, we only want one bulb item per action, and to somehow simplify the process, we can inherit from the &lt;i&gt;BulbItemImpl &lt;/i&gt;class. This class defines an abstract &lt;i&gt;Text &lt;/i&gt;property that represents the text of the bulb item, and also has an &lt;i&gt;ExecuteTransaction&lt;/i&gt; member which is where our code is executed. We&amp;rsquo;ll see the difference between this method and &lt;i&gt;Execute&lt;/i&gt; shortly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6bd1437c-d08c-453d-8bfd-63640ee43d54" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;color:#000;font-size:10pt;border-top:#000080 1px solid;border-right:#000080 1px solid;"&gt;
&lt;div style="background:#ddd;overflow:auto;"&gt;       &lt;ol style="padding-bottom:0px;margin:0px 0px 0px 2.5em;padding-left:5px;padding-right:0px;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;MakeMethodVirtualContextActions&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;: &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IContextAction&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; progress)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; Text&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;(); }&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; cache)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Before implementing any of the methods, there&amp;rsquo;s one thing we need to do. ReSharper requires that context action have a constructor with a parameter that implements a &lt;i&gt;IContextActionDataProvider&lt;/i&gt;. This parameter is actually useful to use to provide information about the context as we&amp;rsquo;ll see shortly. Therefore, we need to add a constructor to the previous code (lines 6-9). Since our action is only for C#, we will use a &lt;i&gt;ICSharpContextActionDataProvider&lt;/i&gt;. We then save this provider for later use (line 3). What we&amp;rsquo;re effectively doing here of course is nothing more than dependency injection. The plumbing (passing in the correct provider) is taken care of for us by ReSharper.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8ccd7ae7-ad88-4e81-a256-4357e662b61b" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;color:#000;font-size:10pt;border-top:#000080 1px solid;border-right:#000080 1px solid;"&gt;
&lt;div style="background:#ddd;overflow:auto;"&gt;       &lt;ol style="padding-bottom:0px;margin:0px 0px 0px 2.5em;padding-left:5px;padding-right:0px;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;MakeMethodVirtualContextAction&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IContextAction&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;readonly&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ICSharpContextActionDataProvider&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; _provider;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; MakeMethodVirtualContextAction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ICSharpContextActionDataProvider&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; provider)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;_provider = provider;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; progress)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; Text&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;(); }&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; cache)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;3. Defining Availability&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The next step is to define when our action is available. In order to do so, we need to implement the &lt;i&gt;IsAvailable&lt;/i&gt; method. In our case, we want to convert methods that are public and not virtual, to virtual. We therefore need to identify methods that are public and not virtual. We also need to filter out static methods. In order to get access to the current context we&amp;rsquo;re in, we can use the &lt;i&gt;provider&lt;/i&gt; we injected in via the constructor. The &lt;i&gt;provider &lt;/i&gt;has a &lt;i&gt;GetSelectedElement&lt;/i&gt; method which corresponds to the element the caret is on. Since we&amp;rsquo;re interested in a method, we can invoke this function, requesting back a method declaration. If the caret is in the context of a method (i.e. header, body), it will return this information. If it&amp;rsquo;s not, it will return null.&lt;/p&gt;
&lt;p&gt;If we have a valid method declaration, the next step is to find out if it is public. We do that by invoking &lt;i&gt;GetAccessRights &lt;/i&gt;[In later series we&amp;rsquo;ll see that further checks are necessary here]. If it is public, we then need to check whether it is a static method, an override or already virtual. Based on that, we return &lt;i&gt;true&lt;/i&gt; or &lt;i&gt;false&lt;/i&gt;, indicating whether the action is available in the current context. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:08892768-5c0f-43d7-bcea-9d5c989520f2" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;color:#000;font-size:10pt;border-top:#000080 1px solid;border-right:#000080 1px solid;"&gt;
&lt;div style="background:#ddd;overflow:auto;"&gt;       &lt;ol style="padding-bottom:0px;margin:0px 0px 0px 2.5em;padding-left:5px;padding-right:0px;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; cache)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; item = _provider.GetSelectedElement&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IMethodDeclaration&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;false&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;);&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; (item != &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; accessRights = item.GetAccessRights();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; (accessRights == &lt;/span&gt;&lt;span style="background:#000000;color:#bf82d7;"&gt;AccessRights&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;.PUBLIC &amp;amp;&amp;amp; !item.IsStatic &amp;amp;&amp;amp; !item.IsVirtual &amp;amp;&amp;amp; !item.IsOverride)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;false&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;4. Performing the action&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;When the action is available and the user selects it, what we need to do is make the method virtual. This is done in the &lt;i&gt;ExecuteTransaction&lt;/i&gt; method. Since we are going to modify the code, we need to make sure that the file is writable. Normally this would be done by invoking a call to a method named &lt;i&gt;EnsureWritable. &lt;/i&gt;However, inside the method &lt;i&gt;ExecuteTransaction&lt;/i&gt;, this is done for us, so we don&amp;rsquo;t have to worry about it. This is one of the differences between &lt;i&gt;ExecuteTransaction &lt;/i&gt;and &lt;i&gt;IBulbItem.Execute&lt;/i&gt;. &lt;/p&gt;
&lt;p&gt;So how do we go about modifying code in ReSharper? Well remember that refactoring code is ReSharper&amp;rsquo;s daily bread. It&amp;rsquo;s what it does. As such, there&amp;rsquo;s a ton of infrastructure in place to allow us to do modify code easily. In fact, making a method virtual is as easy as calling a method, as shown below. &lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1204f257-3604-47b1-8adc-681470f842d7" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;color:#000;font-size:10pt;border-top:#000080 1px solid;border-right:#000080 1px solid;"&gt;
&lt;div style="background:#ddd;overflow:auto;"&gt;       &lt;ol style="padding-bottom:0px;margin:0px 0px 0px 2.5em;padding-left:5px;padding-right:0px;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; progress)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; method = _provider.GetSelectedElement&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IMethodDeclaration&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;false&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;);&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; (method != &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;method.SetVirtual(&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;);&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;5. Testing the plug-in&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The only thing left to do is test that it works (writing unit tests for plug-ins is something we&amp;rsquo;ll cover in the future). One option is to copy the assembly to the plug-in folder for ReSharper and restart Visual Studio. However, in order to be able to debug it, what we can do is set the project properties to start an external program, which is non other than &lt;i&gt;devenv.exe&lt;/i&gt;, and pass as parameter to it &lt;i&gt;/ReSharper.Plugin &amp;lt;Path_to_Plugin_Assembly&amp;gt;&lt;/i&gt;, instructing ReSharper to load a specific plug-in.&lt;/p&gt;
&lt;p&gt;How does ReSharper know which classes in the assembly are context actions? The easiest way is to decorate these with the &lt;i&gt;ContextAction &lt;/i&gt;attribute&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:816a2e31-64f6-4d00-80aa-ab30a90b5de4" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;color:#000;font-size:10pt;border-top:#000080 1px solid;border-right:#000080 1px solid;"&gt;
&lt;div style="background:#ddd;overflow:auto;"&gt;       &lt;ol style="padding-bottom:0px;margin:0px 0px 0px 2em;padding-left:5px;padding-right:0px;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;[&lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;ContextAction&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;(Group=&lt;/span&gt;&lt;span style="background:#000000;color:#a5c25c;"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, Name = &lt;/span&gt;&lt;span style="background:#000000;color:#a5c25c;"&gt;&amp;quot;MakeMethodVirtual&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, Description = &lt;/span&gt;&lt;span style="background:#000000;color:#a5c25c;"&gt;&amp;quot;Adds context action to make methods virtual&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;)]&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;MakeMethodVirtualContextAction&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IContextAction&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This information is also what appears under ReSharper &amp;ndash;&amp;gt; C# &amp;ndash;&amp;gt; Context Actions&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb1" alt="image_thumb1" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb1_5F00_73A114DB.png" border="0" height="279" width="462" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now all that&amp;rsquo;s left is to try it out. Write a new class, add a few methods and check to see it&amp;rsquo;s all working correctly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb41" alt="image_thumb41" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb41_5F00_4C56A5D9.png" border="0" height="188" width="438" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Public static method (not available)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb5" alt="image_thumb5" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb5_5F00_5B3DD4F3.png" border="0" height="123" width="437" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Private method (not available)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb7" alt="image_thumb7" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb7_5F00_3EE06D06.png" border="0" height="206" width="434" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Public method (option available)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:709f2834-932c-4f9c-b242-351e666e3c37" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:709f2834-932c-4f9c-b242-351e666e3c37" class="wlWriterSmartContent"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:905932bc-aad6-4994-8db7-63b30b97fccc" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:07444c36-2481-4557-b32b-f8c211b3e445" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:64c132f0-0ecb-48de-a052-a7760451521b" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:64c132f0-0ecb-48de-a052-a7760451521b" class="wlWriterSmartContent"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;What&amp;rsquo;s next?&lt;/h3&gt;
&lt;p&gt;In this first part we&amp;rsquo;ve seen the basics of writing plug-ins for ReSharper. In the next blog post, we&amp;rsquo;ll extend the example to also include properties and we&amp;rsquo;ll change it to be a &lt;i&gt;QuickFix&lt;/i&gt; as opposed to a context action. This means that we&amp;rsquo;ll get some nice highlighting by ReSharper telling us something can be changed (similar to when you have something named incorrectly for instance), thus being more *in your face*.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s so much more to see than what&amp;rsquo;s here, and gradually we&amp;rsquo;ll drill more into each of the different areas, examining parameters, return values, etc. Until then, Happy ReSharping (did I just coin that? Too lame?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54980" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category></item><item><title>Dynamic objects and ReSharper</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2009/11/24/dynamic-objects-and-resharper.aspx</link><pubDate>Tue, 24 Nov 2009 19:41:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54109</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>23</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=54109</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2009/11/24/dynamic-objects-and-resharper.aspx#comments</comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As you might have heard by now, C# 4.0 (or is it just 4?&amp;hellip;) comes with a new keyword: &lt;b&gt;dynamic&lt;/b&gt;. This means that you could do something like the following:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_08E6464A.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_20314ABB.png" border="0" height="82" width="480" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Simply put, ExpandoObject is a class that allows you to add and remove members at runtime. This allows us to call methods that are resolved at runtime. As such, the previous code will compile. &lt;/p&gt;
&lt;p&gt;Just as you can declare methods, you can also declare properties:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_0AF31F46.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5435C441.png" border="0" height="85" width="477" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This no doubt can come in handy when working with ViewModels and ASP.NET MVC. &lt;/p&gt;
&lt;p&gt;However, there is one minor problem with dynamic objects: you lose intellisense, which means that if in your view, instead of typing &lt;i&gt;dynaCustomer.FirstName&lt;/i&gt;, you type &lt;i&gt;dynaCustomer.FristName&lt;/i&gt;, you won&amp;rsquo;t get any errors until you run the app. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_3FCFFEB6.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_0FC5AD35.png" border="0" height="172" width="472" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;And that&amp;rsquo;s where ReSharper can help:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7A8781BF.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_23AF19FE.png" border="0" height="230" width="468" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This is the same code, but with ReSharper activated inside Visual Studio 2010! I typed the &lt;i&gt;FirstName &lt;/i&gt;property for the first time. After that, I have full intellisense support for it. The same would apply to methods:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_14B7C517.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_727FB990.png" border="0" height="173" width="470" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;That puts &lt;i&gt;dynamic &lt;/i&gt;into perspective. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54109" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category></item><item><title>Getting your OSS binaries with Horn</title><link>http://devlicio.us/blogs/hadi_hariri/archive/2009/11/23/getting-your-oss-binaries-with-horn.aspx</link><pubDate>Mon, 23 Nov 2009 08:54:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54037</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>30</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/hadi_hariri/rsscomments.aspx?PostID=54037</wfw:commentRss><comments>http://devlicio.us/blogs/hadi_hariri/archive/2009/11/23/getting-your-oss-binaries-with-horn.aspx#comments</comments><description>&lt;p&gt;Recently &lt;a href="http://devlicio.us/blogs/billy_mccafferty"&gt;Billy McCafferty&lt;/a&gt; &lt;a href="http://devlicio.us/blogs/billy_mccafferty/archive/2009/10/29/the-horn-project-bringing-quot-apt-get-install-quot-to-net-projects.aspx"&gt;wrote a post&lt;/a&gt; on Horn, a package manager that &lt;a href="http://thesoftwaresimpleton.blogspot.com/"&gt;Paul Cowan&lt;/a&gt; and &lt;a href="http://www.davetheninja.net/"&gt;Dave the Ninja&lt;/a&gt; have developed, similar to the idea of Ruby&amp;rsquo;s Gem. Although it&amp;rsquo;s a step in the right direction, it does have issues. To be able to use it, you need to download Horn and build it. But not only that, you also need to install Subversion, Git, Powershell, Rake, PSake, Cake, Fake&amp;hellip;and a whole slew of SCM&amp;rsquo;s and build tools. Why? Because Horn builds from source. As such, it needs to access the SCM a specific project uses, download the files locally and run the build script. Since OSS projects are free to choose what build script they use, that also adds to the complexity. Some are happy with MSBuild, which isn&amp;rsquo;t normally an issue since it&amp;rsquo;s part of every .NET install. However, others use Rake, which in turn requires Ruby. You get the picture&amp;hellip;&lt;/p&gt;
&lt;p&gt;Although this isn&amp;rsquo;t necessarily an issue for some people, for others, it is. Forgetting for a moment scenarios such as those imposed by IT departments on corporate networks (permissions to install software, firewall, etc..), there are many that are not too comfortable with building from source, something beyond running an MSBuild file or compiling a VS solution inside the IDE. &lt;/p&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;Welcome to Horn Server-Side&lt;/h3&gt;
&lt;p&gt;In order to ease some of these concerns, the Horn team developed a server-side solution. A service now takes care of figuring out all dependencies and building packages and since it does this on a scheduled basis, it saves you the time of having to wait for a project to be built. This also saves you from having to install anything on your machine, including SCM&amp;rsquo;s and build tools. In fact, you don&amp;rsquo;t need to install anything if you don&amp;rsquo;t want to. For you to interact with this server, Dave built an ASP.NET MVC application that shows all the OSS packages in their respective categories. For each package there is normally the official released version and the trunk. &lt;a href="http://www.imeta.com"&gt;iMeta&lt;/a&gt; has gracefully offered to host the server up in clouds. &lt;a href="http://hornget.net"&gt;Go see for yourself&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;If you prefer a command line version, I hacked one together in a morning and it&amp;rsquo;s available from the Horn repository. This allows you to issue commands like: &lt;/p&gt;
&lt;p&gt;&lt;i&gt;horn-get &amp;ndash;u &lt;/i&gt;&lt;a href="http://hornget.net"&gt;&lt;i&gt;http://hornget.net&lt;/i&gt;&lt;/a&gt;&lt;i&gt; &amp;ndash;c orm &amp;ndash;d nhibernate-2.1 &lt;/i&gt;&lt;/p&gt;
&lt;p&gt;which will download NHibernate 2.1 zip for you with the necessary binaries. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Take a look, experiment and &lt;a href="http://groups.google.com/group/horn-development"&gt;provide feedback to the Horn team&lt;/a&gt;. There is still room for improvement, but no doubt, Horn is helping remove some of the barriers in the adoption of Open Source. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54037" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category></item></channel></rss>