<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://dotneteers.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">DiveDeeper&amp;#39;s blog</title><subtitle type="html">The truth is under the surface...</subtitle><id>http://dotneteers.net/blogs/divedeeper/atom.aspx</id><link rel="alternate" type="text/html" href="http://dotneteers.net/blogs/divedeeper/default.aspx" /><link rel="self" type="application/atom+xml" href="http://dotneteers.net/blogs/divedeeper/atom.aspx" /><generator uri="http://communityserver.org" version="4.0.30417.1769">Community Server</generator><updated>2009-07-05T14:31:00Z</updated><entry><title>VS 2010 Package Development – Chapter 1: Visual Studio Packages</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2010/03/02/visual-studio-packages.aspx" /><id>/blogs/divedeeper/archive/2010/03/02/visual-studio-packages.aspx</id><published>2010-03-02T12:13:03Z</published><updated>2010-03-02T12:13:03Z</updated><content type="html">&lt;p&gt;I have spent a lot of time with preparing a book about Visual Studio Extensibility, focusing on Visual Studio Package Development. I have made proposals for several book publishers, but I did not manage to get a contract, most of them found such a book is not profitable. I decided to share the four chapters of the book that I’ve already written. They are the followings:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Chapter 1: Visual Studio Packages &lt;/li&gt;    &lt;li&gt;Chapter 2: Commands, Menus and Toolbars &lt;/li&gt;    &lt;li&gt;Chapter 3: Window Management and Tool Windows &lt;/li&gt;    &lt;li&gt;Chapter 4: Services &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I hope, you will find these chapters useful.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;The majority of Visual Studio’s functions you use in your everyday work (such as programming languages, editors, designers and debuggers) are provided by Visual Studio Integration Packages, or shortly by packages. Some call them VSIP packages but the VSIP acronym is overloaded: while the first two letters means “Visual Studio” the last two may mean either “Integration Package” or “Industry Partner” and unfortunately both terms are frequently used. To avoid ambiguity hereinafter you’ll meet the term package or VSPackage.&lt;/p&gt;  &lt;p&gt;Developing packages means you can extend Visual Studio on the same way as its developer team at Microsoft. Adding new functions through packages is actually programming a new part of Visual Studio just like if you were the member of the team. You can use the full power and integrate any functionality you miss from the IDE!&lt;/p&gt;  &lt;p&gt;In this chapter you will create a very simple package called FirstLook to get a feeling that first steps are easy. Then you’ll learn the basic concepts behind packages and dive into the FirstLook project’s structure and source code to have a closer look at the implementation of those concepts. At the end of this chapter you’ll be familiar with the following:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Building a package with the VSPackage Wizard &lt;/li&gt;    &lt;li&gt;The idea of a package &lt;/li&gt;    &lt;li&gt;The on-demand package loading mechanism and the idea of package siting &lt;/li&gt;    &lt;li&gt;Registration of packages and information stored in the registry &lt;/li&gt;    &lt;li&gt;The Visual Studio Experimental Hive and using it for debugging packages &lt;/li&gt;    &lt;li&gt;The package build process &lt;/li&gt;    &lt;li&gt;Deploying VSPackages &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This chapter will not teach you how to build a specific functionality into a package and does not cover the API used to develop packages. The focus is on understanding the concepts, architectural considerations behind VSPackages to let you take a look behind the scenes and get acquainted with package mechanisms. These concepts will be very useful when you are about creating your own packages.&lt;/p&gt;  &lt;h2&gt;Building a Simple Package&lt;/h2&gt;  &lt;p&gt;There are a few important concepts to understand if you want to develop a package. In order treat them in the right context you build a very simple functional package to touch the surface of those concepts and then jump into the details.&lt;/p&gt;  &lt;p&gt;A Visual Studio package is a class library containing the types responsible for the package infrastructure and functionality. In order Visual Studio recognize the compiled class library as package, encapsulated types should have specific metadata information and some additional steps are required after compilation. So, even if you could start building a package from an empty class library, it is much easier to use the VSPackage Wizard installed with Visual Studio SDK.&lt;/p&gt;  &lt;p&gt;Start a new project with the File|New|Project command. The IDE displays the &lt;strong&gt;New File&lt;/strong&gt; dialog to select the desired project type. You can find the Visual Studio Integration Package project type under the Other Project Types category in the Extensibility folder as Figure 1 illustrates.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0301_5F00_68B89CC3.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0301" border="0" alt="f0301" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0301_5F00_thumb_5F00_28828349.png" width="660" height="363" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 1&lt;/strong&gt;: &lt;em&gt;The New Project dialog with the Extensibility project types&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Should you not find this project type or many other project types in the Extensibility folder means that Visual Studio SDK is not — or not properly — installed on your machine. Install it according to the setup notes in order to go on with building the package.&lt;/p&gt;  &lt;p&gt;Give the &lt;strong&gt;FirstLook&lt;/strong&gt; name to the package in order to be able to follow code details later in this chapter. Clicking the OK button starts the Visual Studio Integration Package Wizard (henceforward VSPackage Wizard is used, it is shorter) which welcomes you with the dialog in Figure 2.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0302_5F00_0BFEB9E8.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0302" border="0" alt="f0302" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0302_5F00_thumb_5F00_04DF7D70.png" width="536" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 2&lt;/strong&gt;: &lt;em&gt;The Welcome page of the VSPackage Wizard&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Click the Next button to go on specifying the package parameters and you get to the Select a Programming Language page of the wizard as Figure 3 shows.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0303_5F00_7DC040F7.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0303" border="0" alt="f0303" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0303_5F00_thumb_5F00_0B9286F3.png" width="536" height="414" /&gt;&lt;/a&gt;&lt;strong&gt; &lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 3&lt;/strong&gt;: &lt;em&gt;VSPackage Wizard lets you select the programming language&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;As it was mentioned earlier you create the code in C#. Packages are strongly named assemblies, so you need to sign the class library assembly with a key. For this project the wizard creates the signing key. Click Next and you get to the Basic VSPackage Information page as Figure 4 shows.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0304_5F00_5685F7C2.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0304" border="0" alt="f0304" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0304_5F00_thumb_5F00_7D540E02.png" width="536" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 4&lt;/strong&gt;: &lt;em&gt;The wizard asks for the basic package information&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The information you provide here will be used in the source code generated for the package and will be displayed in the Visual Studio About dialog. The Company name will be used in the namespace of generated types as well as VSPackage name which also names the class representing the package in code. VSPackage version is additional information to give a way for distinguishing separate package releases.&lt;/p&gt;  &lt;p&gt;Text typed in the Detailed information field will be displayed in the About dialog and can supply the user with more information about what the package does.&lt;/p&gt;  &lt;p&gt;When you click the Next button the wizard moves you to the VSPackage Options page — as can be seen in Figure 5 — to set a few more code generation options.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0305_5F00_0B2653FE.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0305" border="0" alt="f0305" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0305_5F00_thumb_5F00_6B0B4740.png" width="536" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 5&lt;/strong&gt;: &lt;em&gt;You can select a few code generation options&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In this sample you are going to create only a menu command that pops up a message on the screen, so set the Menu Command option. Should you select the other two options the VSPackage Wizard would create some more code for a simple tool window or a rich text editor. Please, let those options remain unchecked. With the Next button the wizard goes to the page where we can specify a few details about the menu command to create. This page is shown in Figure 6.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0306_5F00_0D432898.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0306" border="0" alt="f0306" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0306_5F00_thumb_5F00_34113ED8.png" width="536" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 6&lt;/strong&gt;: &lt;em&gt;Command options are specified here&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The command will be added to the Tools menu of Visual Studio, in Command name you can specify the text to be displayed for the menu item. According to the internal command handling architecture each command has an identifier. The Command ID field supplies a name for this identifier and VSPackage Wizard will generate an ID value behind this name. With clicking Next the wizard moves to the Test Project Options page as shown in Figure 7.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0307_5F00_6A2EB371.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0307" border="0" alt="f0307" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0307_5F00_thumb_5F00_10FCC9B2.png" width="536" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 7&lt;/strong&gt;: &lt;em&gt;VSPackage Wizard asks for test project options&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;The wizard can create unit test for the package which check if its functional units work properly. The wizard also can create an integration test project for you, in which packages are tested within the context of a Visual Studio instance.&lt;/p&gt;  &lt;p&gt;For the sake of simplicity here you do not create any tests, so clear the options — by default both are checked. Now you have set all parameters the wizard uses to generate the package project, click on the Finish button.&lt;/p&gt;  &lt;p&gt;In a few seconds the wizard generates the package project ready to build and run. Taste the pudding you have just cooked! With the Build ð Rebuild Solution function you can compile the package and carry out all other steps required to run the package with Visual Studio. So rebuild the project and start with Ctrl + F5 (Debug|Start Without Debugging).&lt;/p&gt;  &lt;p&gt;You might be surprised as a new instance of Visual Studio is started with “Experimental Instance” in its window caption.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: If this is the first time you have started the Experimental Instance, the Choose Default Environment Settings dialog appears just like when you first time launch Visual Studio after installation.&lt;/p&gt;  &lt;p&gt;This is an instance of Visual Studio that hosts the &lt;strong&gt;FirstLook&lt;/strong&gt; package — later you’re going to learn the concept behind. The menu command implemented by this freshly generated package can be seen in the Tools menu as Figure 8 shows it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0308_5F00_5BF03A81.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0308" border="0" alt="f0308" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0308_5F00_thumb_5F00_3BD52DC4.png" width="368" height="136" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 8&lt;/strong&gt;: &lt;em&gt;The menu command item appears in the Tools menu&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;When you click the Simple Message command, it pops up a message box telling you it was displayed from the &lt;strong&gt;FirstLook&lt;/strong&gt; package.&lt;/p&gt;  &lt;p&gt;The package also registered some branding information that can be seen in the Help|About dialog as Figure 9 shows.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0309_5F00_1BBA2107.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0309" border="0" alt="f0309" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0309_5F00_thumb_5F00_747FD7D1.png" width="660" height="498" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 9&lt;/strong&gt;: &lt;em&gt;Branding information of the &lt;strong&gt;FirstLook&lt;/strong&gt; package&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Nothing call tell more about your VSPackage than its source code. But before deep-diving into it, let’s treat important concepts about packages.&lt;/p&gt;  &lt;h2&gt;&lt;a name="_Toc234410284"&gt;&lt;/a&gt;&lt;a name="_Toc224959878"&gt;&lt;/a&gt;Concepts behind Visual Studio Packages&lt;/h2&gt;  &lt;p&gt;A VSPackage is the principal architectural unit of Visual Studio. As you already know, Visual Studio IDE itself is the Shell hosting a set of VSPackages working together with each other and with the Shell. The basic responsibility of a package is to provide a common container for extensibility objects. So, a VSPackage is a software module that is a unit not only from architectural point of view but also from deployment, security and licensing aspects.&lt;/p&gt;  &lt;p&gt;Developers — including the developers of Visual Studio — create VSPackages to provide some extension to the VS IDE and group them into modules according to their functionality. These extensions can be:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Services&lt;/strong&gt;. These are software objects that offer functionality for other objects in the same package or even for other packages. For example, the C# Language Service (as its name also tells) is a service. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;User interface elements&lt;/strong&gt;. Menus, toolbars, and windows can be used by developers to initiate some actions in the user interface, interact with, display messages, information and figures, and so on. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Editors&lt;/strong&gt;. During development you write and modify program text to create applications. This task is the responsibility of an editor. Visual Studio 2010 has its own core text editor and you can extend it or even create your own editors. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Designers&lt;/strong&gt;. Application creation is not just simply a text-typing activity. There are many visual tools known as designers that allow an alternative representation and design of modules, components, parts or even full applications. Well-known examples are the Windows Forms designer, The WPF Forms designer, the ASP.NET page designer or the Data Table designer. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Projects&lt;/strong&gt;. When developing applications you generally work with a large number of files. A project is an organization of source files and resources. A project not just simply stores these files but also defines operations with them, allows building, debugging and deploying the products created from source files. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;It is natural in .NET that you can divide your functional units into separate assemblies where consumer assemblies will reference other service assemblies. The same principle works for VSPackages: an assembly containing a package can reference other assemblies that may contain not just helper types but even extensibility object types.&lt;/p&gt;  &lt;p&gt;An assembly — as the smallest physical deployment unit in .NET — may contain more than one VSPackage. Although generally only one package is encapsulated in an assembly, you may have many reasons to group more packages in one assembly — including deployment considerations.&lt;/p&gt;  &lt;h3&gt;The Package Load Key&lt;/h3&gt;  &lt;p&gt;The previous versions of Visual Studio checked the package before loading them into the process space of the Shell. Any VSPackage should have been “sealed” with a so-called Package Load Key (PLK) and this key was verified during package load time. PLK was not a digital signature or a full hash, because it was calculated from a few information fields in the package. PLK could have been requested from Microsoft through a webpage: the developer specified a few well-defined attributes of the package and some logic calculated the PLK value. This value was embedded as a resource into the assembly representing the package.&lt;/p&gt;  &lt;p&gt;Every time the package was loaded, the Shell checked the PLK against the package attributes it had been created from. Should have been this check fail, the Shell would have refused loading the package. This PLK mechanism did not mean that a developer had to request a new PLK for each package modification. While no basic information the PLK had been generated from was changed, the package continued to load.&lt;/p&gt;  &lt;p&gt;Although this concept had been seemed useful, in the real life in had no real advantage. To be honest, in most of the cases it was the root cause of deployment issues, in many scenarios it raised more problems than it solved.&lt;/p&gt;  &lt;p&gt;In the new Visual Studio 2010 the Shell does not use the Package Load Key to check packages before loading them into the memory.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410285"&gt;&lt;/a&gt;&lt;a name="_Toc224959880"&gt;&lt;/a&gt;&lt;a name="_Toc223159723"&gt;&lt;/a&gt;On-demand Loading of Packages&lt;/h3&gt;  &lt;p&gt;You can imagine that complex packages like the C#, VB, F# or C++ languages with all of their “accessories” could consume many system resources by terms of memory and CPU. If you do not use them they do not press the CPU, but they might use the memory if they sit within the Visual Studio process space. If you create a project using F# you actually do not need services belonging to other languages, so why to load them into the memory at all?&lt;/p&gt;  &lt;p&gt;The architects of Visual Studio implemented the package load mechanism so that packages are loaded into the memory at the first time when an event requiring the presence of the package is raised. These events can be one of the followings:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Command activation&lt;/strong&gt;. The user (or some running code) activates a menu or toolbar command (or even a command that cannot be accessed from UI) served by a package which has not been loaded yet. It does not matter if the user has clicked on a menu item or the running code has activated it with a “virtual click” the result is the same. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Object or service request&lt;/strong&gt;. The Shell is about to use an object or a service in a package not loaded yet. For example a tool window should be displayed or a service function is about to be executed. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Context change&lt;/strong&gt;. The Shell can enter into certain user interface contexts. For example, when you start debugging a project, the Shell enters into the Debugging context. When a solution with a single project is loaded, the Shell enters into the &lt;strong&gt;SolutionHasSingleProject&lt;/strong&gt; context. You can declare that a package should be loaded as the Shell enters in a certain context. Visual Studio has a few predefined contexts, but you can also define your own ones. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So, if you do not need a package during the whole IDE session, it does not consume the memory at all. Should you click on a menu item activating a command sitting in a package which has not been loaded yet the IDE will immediately load and initialize it. Should you ask for a tool window in a package not in the memory yet, the IDE will start loading it.&lt;/p&gt;  &lt;p&gt;Binding package loading with a context change is generally required where your package want to subscribe for events raised in Visual Studio. You cannot bind the event either to command activation or object or service requests, because in order your package could work you have to subscribe to events. The code to create subscriptions is generally put into the initialization code. But you cannot run any code belonging to a package while it is not loaded into the memory! In this case you declare that the best context (the latest possible) to load the package. If your package logic requires, you can specify the &lt;strong&gt;NoSolutionExists&lt;/strong&gt; context. Visual Studio enters into this context immediately when the Shell is loaded and ready to function, so packages bound to this context load at Visual Studio startup time.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: Be frugal with system resources if you have to load a package at Visual Studio startup time. Allocate only resources that are indispensable to carry out the required initialization at startup time.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410286"&gt;&lt;/a&gt;&lt;a name="_Toc224959881"&gt;&lt;/a&gt;Package Siting&lt;/h3&gt;  &lt;p&gt;When you develop a package it is an independent piece of code. When it is loaded into Visual Studio it becomes an organic part of the IDE:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Your package can access services and objects provided by the Shell and other packages. &lt;/li&gt;    &lt;li&gt;The Shell and other packages can access the objects and services you proffer them. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The process of making a package physically integrated into the Shell is called &lt;i&gt;siting&lt;/i&gt;. While the package is not sited, its functions cannot be used from outside. From the same reason the package can be only partially initialized, because it cannot touch any objects or services through the Shell. As soon as the package gets sited, it is ready to finish its initialization and be fully functional. Siting happens when Visual Studio loads the package.&lt;/p&gt;  &lt;p&gt;The object type representing your package must implement an interface called IVsPackage (you are going to learn details later in this chapter) and must have a default constructor.&lt;/p&gt;  &lt;p&gt;Loading a package contains the following steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Shell creates an instance of the object type representing your package by invoking its default constructor. &lt;/li&gt;    &lt;li&gt;The Shell calls the SetSite method of the object instance — IVsPackage defines this method — and passes a so-called service provider instance which can be used by the package to query objects in order to access services implemented by the Shell or other packages. &lt;/li&gt;    &lt;li&gt;The Shell allows your package to finish its initialization. In the first step during the construction call the service object did not have any contact with the Shell. After siting all initialization steps invoking Shell services can be carried out. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Although siting physically integrates your package functionally with Visual Studio, functional integration may require some additional — and sometimes complex — steps depending on what your package is intended to do.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410287"&gt;&lt;/a&gt;&lt;a name="_Toc224959882"&gt;&lt;/a&gt;Package Registration&lt;/h3&gt;  &lt;p&gt;Visual Studio must keep track of packages in order to load and use them. Of course, the most flexible would be some kind of discovery where the Shell can look around only in the file system to guess out which entities represent packages. The .NET framework supports and intensively uses metadata (attributes) that can represent the information you can use for this purpose. You can even load an assembly so that only the metadata part is read from the file system and put into the memory. Although you can imagine this mechanism could work, it is not used by the Shell in this way.&lt;/p&gt;  &lt;p&gt;The reason is that the roots of Visual Studio go back to the COM era. Packages are COM objects and can be created not only in managed code but also in native code using the Win32 API with any language including C++, Delphi and others. So, not surprisingly Visual Studio uses the registry to keep information about packages.&lt;/p&gt;  &lt;p&gt;Although the registry is used to store configuration information about Visual Studio settings, developers and package users are not bothered with registration issues. The new deployment mechanism (through VSIX files) implemented in Visual Studio 2010 takes away this task. When Visual Studio is started, its discovery mechanism collects the information to be entered into the registry and does all the registration process on the fly. Developers perceive they do installation only by copying files and this resembles to the great mechanism we are using with the .NET Framework.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410288"&gt;&lt;/a&gt;&lt;a name="_Toc224959883"&gt;&lt;/a&gt;Package Information in the Registry&lt;/h3&gt;  &lt;p&gt;Packages are loaded into the memory on-demand. To effectively use this approach, Visual Studio stores the registration information about packages in a way so that this information could be accessed from the direction of objects to be used. For example, one kind of object that could trigger package loading is a tool window. A tool window has its own identity. When it is about to be created in order to be displayed, Visual Studio turns into the registry and addresses the corresponding key with the tool window identity. Under that key there is information stored about the identity of the package owning and implementing the tool window. Using this identity Visual Studio finds the registry key containing the package information and loads the package into the memory accordingly. The identity of packages and objects is represented by a GUID.&lt;/p&gt;  &lt;p&gt;Figure 10 shows a few registry keys that store package-related information for Visual Studio.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0310_5F00_52102F05.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0310" border="0" alt="f0310" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0310_5F00_thumb_5F00_4AF0F28D.png" width="351" height="358" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 10&lt;/strong&gt;: &lt;em&gt;Package and object information in the registry&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Assume that Visual Studio is about to create a service instance. It uses the Services registry key and according to the service identity it finds the package. Figure 11 illustrates the service key of the Class Designer Service. At the left side you can see the subkey named by the GUID identifying the service. At the right side you see the corresponding package ID in the default value under the service key.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0311_5F00_6EE0DBE0.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0311" border="0" alt="f0311" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0311_5F00_thumb_5F00_2EAAC266.png" width="660" height="301" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 11&lt;/strong&gt;: &lt;em&gt;Service information in the registry&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Visual Studio uses the same approach to find owner packages for any other objects.&lt;/p&gt;  &lt;p&gt;There is one important thing to treat about package information in the registry. Packages can add their own user interface items to the Visual Studio IDE in form of menus and toolbars. If this UI information were created during the package initialization time, Visual Studio would need to load the package at startup time in order to present the package-dependent UI to the users. This approach would demolish the whole concept of on-demand loading.&lt;/p&gt;  &lt;p&gt;Instead, the package uses a declarative way to define the user interface that should be displayed in the IDE at startup time. This information is encapsulated into the package assembly as an embedded resource. During the registration process Visual Studio extracts this resource information and merges it with its standard menus. Each user interface element — the commands they represent — is associated with the identity (GUID) of the owner package, so the Shell knows which package to load when a command is activated.&lt;/p&gt;  &lt;h3&gt;Visual Studio Experimental Instance&lt;/h3&gt;  &lt;p&gt;When you started the FirstLook package a new instance of Visual Studio was launched with the “Experimental Instance” text in its caption. What is that Visual Studio instance and how did it get to the computer?&lt;/p&gt;  &lt;p&gt;Visual Studio Experimental Instance is a test bed to run and debug Visual Studio packages during the development and test phase. It is not a new installation of Visual Studio. It is the same &lt;strong&gt;devenv.exe&lt;/strong&gt; file you use normally. But why you need it?&lt;/p&gt;  &lt;p&gt;As it’s been mentioned earlier the package is registered — information is written into the system registry — in order it could integrate with Visual Studio. Every time you build and run a package some information goes into the registry. When you modify the package it might affect also the information in the registry. You can imagine what an unexpected confusion it can lead that you always modify the registry under the Visual Studio instance you actually use to develop and debug a package? What if your package does not work or even worse it prevents Visual Studio start correctly or even causes a crash? How would you fix the pollution of registry?&lt;/p&gt;  &lt;p&gt;That is the point when Visual Studio Experimental Instance comes into the picture. The Experimental Instance is simply another instance of Visual Studio that picks up its settings from a different place — including configuration files and registry keys.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;devenv.exe&lt;/strong&gt; keeps its configuration settings in the system registry in the &lt;strong&gt;CURRENT_USER&lt;/strong&gt; hive under the&lt;strong&gt; Software\Microsoft\VisualStudio\10.0_Config&lt;/strong&gt; key. When Visual Studio runs it reads out the configuration information from these keys by default. With the &lt;strong&gt;/rootsuffix&lt;/strong&gt; command line parameters the root key used by &lt;strong&gt;devenv.exe&lt;/strong&gt; can be changed.&lt;/p&gt;  &lt;p&gt;The VSPackage Wizard sets up the package project so that the &lt;strong&gt;devenv.exe&lt;/strong&gt; uses the &lt;strong&gt;/rootsuffix Exp&lt;/strong&gt; command line parameter when running or debugging the package. By doing it so &lt;strong&gt;devenv.exe&lt;/strong&gt; will use the &lt;strong&gt;Software\Microsoft\VisualStudio\10.0Exp_Config&lt;/strong&gt; registry key under the &lt;strong&gt;CURRENT_USER&lt;/strong&gt; registry hive. So running the package with the Start Debugging (F5) or Start Without Debugging (Ctrl+F5) functions will launch the Visual Studio Experimental Instance using this registry key.&lt;/p&gt;  &lt;p&gt;The build process of a package copies the package binaries and the so-called VSIX manifest information to a well-known location under the current user’s application data folder. When the Experimental Hive starts, it discovers the package in the folder and uses the information found there to enter the package information into the registry key consumed by the Experimental Instance.&lt;/p&gt;  &lt;p&gt;Using the Experimental Instance prevents you polluting the registry of the Visual Studio instance used for the normal development process. However, making mistakes, recompilations and faulty package registrations does not prevent putting junk or leaving orphaned information in the Experimental Instance registry. Making an appropriate cleanup could be very complex and dangerous if you would do it by delving in the registry.&lt;/p&gt;  &lt;p&gt;Cleaning up packages from the Experimental Instance’s registry is quite easy! The Visual Studio SDK installs the &lt;strong&gt;CreateExpInstance.exe&lt;/strong&gt; utility and adds it to the Visual Studio 2010 SDK menu items under the Tools folder with the name “Reset the Microsoft Visual Studio 2010 Experimental Instance”. Running this utility will reset the registry key belonging to the Experimental Hive to the state after the installation of VS SDK.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: If you develop Visual Studio packages you can get into situations several times where your package which worked before seems suddenly stop working. In majority of these cases the cause is the pollution of Visual Studio registry. There can be many orphaned objects in the registry as a result of continuous modification and rebuild of packages, and that can cause problems. If you run in such a situation, reset the Experimental Instance and then build your package with the Rebuild All function of Visual Studio. This procedure often helps.&lt;/p&gt;  &lt;h2&gt;&lt;a name="_Toc234410290"&gt;&lt;/a&gt;&lt;a name="_Toc224959885"&gt;&lt;/a&gt;Diving into the Package Source Code&lt;/h2&gt;  &lt;p&gt;You have already created a &lt;strong&gt;FirstLook&lt;/strong&gt; project with the VSPackage wizard and by now you have a good overview about the basic concepts behind packages. Now we go into details and look how those concepts and ideas are reflected in the source code.&lt;/p&gt;  &lt;p&gt;When the VSPackage Wizard generated the code according to the parameters we specified on the wizard pages, it made a lot of work at the background. The wizard carried out the following activities:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Generation of a class library project in C#. &lt;/li&gt;    &lt;li&gt;Adding references to this project for the interoperability assemblies required to access Visual Studio functionality. &lt;/li&gt;    &lt;li&gt;Creating resources used by the package and other resources used by the registration process. &lt;/li&gt;    &lt;li&gt;Adding new MSBuild targets to the project to support the build and registration process of the package. &lt;/li&gt;    &lt;li&gt;Generation of types responsible for implementing the package functionality. &lt;/li&gt;    &lt;li&gt;Setting up the debug properties of the project to start Visual Studio Experimental Instance. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Table 1 summarizes the source files in the &lt;strong&gt;FirstLook&lt;/strong&gt; project.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Table 1&lt;/strong&gt;: &lt;em&gt;FirstLook source files generated by the VSPackage wizard&lt;/em&gt;&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2"&gt;     &lt;tr&gt;       &lt;td&gt;&lt;strong&gt;Source File&lt;/strong&gt;&lt;/td&gt;        &lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;source.extension.vsixmanifest&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;This is the so-called VSIX manifest file which plays vital role in the discovery and registration mechanism of Visual Studio extensions. &lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;FirstLook.vsct&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;The so-called command table file storing the definition of the menus and commands to be merged into the Visual Studio IDE during the registration process.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;FirstLookPackage.cs&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;Class implementing the simple functionality of the package.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;GlobalSupressions.cs&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;Attributes used to suppress messages coming from the static code analysis.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;Guids.cs&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;GUID values used to identify the package and command objects within the package.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;Key.snk&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;Signing key used to generate the strong name for the package assembly.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;PkgCmdID.cs&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;Constants for identifying command values.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;Resources.resx&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;Resource file to store your functional package resources — resources you use according to the functions you implement in the package.&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;em&gt;VSPackage.resx&lt;/em&gt;&lt;/td&gt;        &lt;td&gt;Resource file to store package infrastructure resources — those resources which are used by Visual Studio to integrate your package into the IDE.&lt;/td&gt;     &lt;/tr&gt;   &lt;/table&gt;  &lt;p&gt;The wizard added several assemblies to the class library project. Table 2 summarizes their roles. Their names start with the &lt;strong&gt;Microsoft.VisualStudio&lt;/strong&gt;, this prefix is omitted in the table for the sake of clarity.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Table 2&lt;/strong&gt;: &lt;em&gt;Interoperability assembly references in the project&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;   &lt;table cellspacing="0" cellpadding="2"&gt;       &lt;tr&gt;         &lt;td&gt;&lt;strong&gt;Source File&lt;/strong&gt;&lt;/td&gt;          &lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;~.Shell.Interop&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;This assembly defines several hundreds of core interoperability types (interfaces, structures, enumerations, classes, etc.).&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;~.Shell.Interop.8.0, ~.Shell.Interop.9.0 &lt;/em&gt;and&lt;em&gt; ~.Shell.Interop.10.0&lt;/em&gt; &lt;/td&gt;          &lt;td&gt;There are COM types new in VS 2005, VS 2008 and VS 2010 IDEs. The interoperability wrappers of them are defined in these assemblies where the 8.0 suffix is for VS 2005, the 9.0 suffix for VS 2008 while the 10.0 suffix for VS 2010.&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;~.Shell.Interop.Immutable.10.0&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;A few abstract and enumeration types used for package registration attributes.&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;~.OLE.Interop&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;There are a few hundred of standard OLE types and interfaces. This assembly provides wrapper types for them.&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;~.Shell.9.0&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;The core types of the Managed Package Framework. There is a separate version for VS 2008 with the 9.0 suffix. If you work with VS 2008, you should use this assembly.&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;~.TextManager.Interop&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;Interoperability assembly with wrapper types to access text editor and text management functionality. Although this assembly is referenced by the project, it is not used in the package you’ve created.&lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;All assemblies having Interop in their names contain only proxy type definitions to access the core Visual Studio COM service interface and object types.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410291"&gt;&lt;/a&gt;&lt;a name="_Toc224959886"&gt;&lt;/a&gt;Package Type Definition&lt;/h3&gt;  &lt;p&gt;Now, let’s see the source code of the package! The wizard added many useful comments to the generated source files. In the code extracts listed here those commands are cut out to make the listings shorter and improve the readability of the code. The indentation has also been changed a bit for the same purpose.&lt;/p&gt;  &lt;p&gt;Listing 1 shows the source code of the most important file in our project named FirstLookPackage.cs. This file implements the type representing our package:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Listing 1&lt;/strong&gt;: &lt;em&gt;FirstLookPackage.cs&lt;/em&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:1a61b8d0-d94d-4134-bc59-650501d47e97" 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:#ffffd5;margin:0 0 0 2.5em;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.ComponentModel.Design;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Diagnostics;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Globalization;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Runtime.InteropServices;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.VisualStudio.Shell;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; Microsoft.VisualStudio.Shell.Interop;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;namespace&lt;/span&gt; DeepDiver.FirstLook&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;[&lt;span style="color:#2b91af;"&gt;PackageRegistration&lt;/span&gt;(UseManagedResourcesOnly = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;)]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;[&lt;span style="color:#2b91af;"&gt;InstalledProductRegistration&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;#110&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;#112&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;, IconResourceID = 400)]&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;[&lt;span style="color:#2b91af;"&gt;ProvideMenuResource&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Menus.ctmenu&amp;quot;&lt;/span&gt;, 1)]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;[&lt;span style="color:#2b91af;"&gt;Guid&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;GuidList&lt;/span&gt;.guidFirstLookPkgString)]&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;sealed&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FirstLookPackage&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Package&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; FirstLookPackage()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;Trace&lt;/span&gt;.WriteLine(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#2b91af;"&gt;CultureInfo&lt;/span&gt;.CurrentCulture, &lt;span style="color:#a31515;"&gt;&amp;quot;Entering constructor for: {0}&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ToString()));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Initialize()&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;Trace&lt;/span&gt;.WriteLine(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#2b91af;"&gt;CultureInfo&lt;/span&gt;.CurrentCulture, &lt;span style="color:#a31515;"&gt;&amp;quot;Entering Initialize() of: {0}&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ToString()));&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Initialize();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// Add our command handlers for menu (commands must exist in the .vsct file)&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;OleMenuCommandService&lt;/span&gt; mcs = GetService(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;IMenuCommandService&lt;/span&gt;)) &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;OleMenuCommandService&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;null&lt;/span&gt; != mcs)&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// Create the command for the menu item.&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;CommandID&lt;/span&gt; menuCommandID = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CommandID&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;GuidList&lt;/span&gt;.guidFirstLookCmdSet, (&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;PkgCmdIDList&lt;/span&gt;.cmdidShowMyMessage);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;MenuCommand&lt;/span&gt; menuItem = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;MenuCommand&lt;/span&gt;(MenuItemCallback, menuCommandID);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;mcs.AddCommand(menuItem);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; MenuItemCallback(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, &lt;span style="color:#2b91af;"&gt;EventArgs&lt;/span&gt; e)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// Show a Message Box to prove we were here&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;IVsUIShell&lt;/span&gt; uiShell = (&lt;span style="color:#2b91af;"&gt;IVsUIShell&lt;/span&gt;)GetService(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;SVsUIShell&lt;/span&gt;));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;Guid&lt;/span&gt; clsid = &lt;span style="color:#2b91af;"&gt;Guid&lt;/span&gt;.Empty;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; result;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;Microsoft.VisualStudio.&lt;span style="color:#2b91af;"&gt;ErrorHandler&lt;/span&gt;.ThrowOnFailure(uiShell.ShowMessageBox(&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;0,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;ref&lt;/span&gt; clsid,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&amp;quot;FirstLook&amp;quot;&lt;/span&gt;,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#2b91af;"&gt;CultureInfo&lt;/span&gt;.CurrentCulture, &lt;span style="color:#a31515;"&gt;&amp;quot;Inside {0}.MenuItemCallback()&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ToString()),&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Empty,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;0,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;OLEMSGBUTTON&lt;/span&gt;.OLEMSGBUTTON_OK,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;OLEMSGDEFBUTTON&lt;/span&gt;.OLEMSGDEFBUTTON_FIRST,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;OLEMSGICON&lt;/span&gt;.OLEMSGICON_INFO,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;0,&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// false&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;out&lt;/span&gt; result));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The &lt;strong&gt;FirstLookPackage&lt;/strong&gt; class becomes a working package by inheriting the behavior defined in the Package class of the&lt;strong&gt; Microsoft.VisualStudio.Shell&lt;/strong&gt; namespace and by using the attributes decorating the class definition.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;Package&lt;/strong&gt; base class implements the &lt;strong&gt;IVsPackage&lt;/strong&gt; interface that is required by Visual Studio in order to take an object into account as a package. This interface provides a few methods managing the lifecycle of a package and also offers methods to access package related objects like tool windows, options pages, and automation objects. One of the most important of them is the &lt;strong&gt;SetSite&lt;/strong&gt; method having the following signature:&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:8568125d-2981-42f0-8816-a4f118af7192" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; SetSite(IServiceProvider psp);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Visual Studio calls this method immediately after the package has been instantiated by its default constructor. The &lt;strong&gt;psp&lt;/strong&gt; parameter is an instance of &lt;strong&gt;System.IServiceProvider&lt;/strong&gt; and this object is the key in keeping contact between the package and the IDE: any time the package requests a service object from its context—from the IDE—the &lt;strong&gt;psp&lt;/strong&gt; instance is used at the back, however, the implementation of &lt;strong&gt;Package&lt;/strong&gt; hides it from our eyes.&lt;/p&gt;  &lt;p&gt;The overridden &lt;strong&gt;Initialize&lt;/strong&gt; method is called after the package has been successfully sited. This method has to do all the initialization steps that require access to services provided by the Shell or other packages. Should you move this code to the package constructor you would get a &lt;strong&gt;NullReferenceException&lt;/strong&gt; because at that point all attempts to access the Shell would fail as the package is not sited yet and actually has no contact with any shell objects.&lt;/p&gt;  &lt;p&gt;The package constructor should do only inexpensive initialization that you would put normally to a constructor. Any other kind of initialization activities should be put to the overridden &lt;strong&gt;Initialize&lt;/strong&gt; method. If you have some other expensive initialization activity that can be postponed, you should do them right when there’s no more time to delay them.&lt;/p&gt;  &lt;p&gt;In this case the &lt;strong&gt;Initialize&lt;/strong&gt; method binds the single menu command provided by the &lt;strong&gt;FirstLookPackage&lt;/strong&gt; with its event handler method called &lt;strong&gt;MenuItemCallback&lt;/strong&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:1326b578-63c3-458a-9c3a-1586c09f3280" 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:#ffffd5;margin:0 0 0 2.5em;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Initialize()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;Trace&lt;/span&gt;.WriteLine(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.Format(&lt;span style="color:#2b91af;"&gt;CultureInfo&lt;/span&gt;.CurrentCulture, &lt;span style="color:#a31515;"&gt;&amp;quot;Entering Initialize() of: {0}&amp;quot;&lt;/span&gt;, &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ToString()));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Initialize();&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// Add our command handlers for menu (commands must exist in the .vsct file)&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;OleMenuCommandService&lt;/span&gt; mcs = GetService(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;IMenuCommandService&lt;/span&gt;)) &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;OleMenuCommandService&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;null&lt;/span&gt; != mcs)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// Create the command for the menu item.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;CommandID&lt;/span&gt; menuCommandID = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CommandID&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;GuidList&lt;/span&gt;.guidFirstLookCmdSet, (&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;PkgCmdIDList&lt;/span&gt;.cmdidShowMyMessage);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;MenuCommand&lt;/span&gt; menuItem = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;MenuCommand&lt;/span&gt;(MenuItemCallback, menuCommandID);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;mcs.AddCommand(menuItem);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;First it calls the &lt;strong&gt;Initialize&lt;/strong&gt; method of the base class — &lt;strong&gt;Package&lt;/strong&gt; in this case. Omitting the call to the base implementation would prevent the package running correctly. Look at the call of &lt;strong&gt;GetService&lt;/strong&gt; in Line 7! If you could select a method that is especially very important when creating Visual Studio Extensions, probably the &lt;strong&gt;GetService&lt;/strong&gt; method is that one! This method is implemented by the &lt;strong&gt;Package&lt;/strong&gt; class — many other Managed Package Framework objects also implement this method — in order to request service objects from the environment. &lt;strong&gt;GetService&lt;/strong&gt; has one type parameter — it’s called service address — that retrieves a service object implementing the service interface specified by the address type.&lt;/p&gt;  &lt;p&gt;So, Line 7 obtains an &lt;strong&gt;OleMenuCommandService&lt;/strong&gt; instance that you can use to bind event handlers to so-called command objects. In Line 11 and 12 a &lt;strong&gt;CommandID&lt;/strong&gt; instance is created to address the command to be put to the Tools menu. In Line 12 a &lt;strong&gt;MenuCommand&lt;/strong&gt; instance is created to assigns the &lt;strong&gt;MenuItemCallback&lt;/strong&gt; method as a response for the command specified with the &lt;strong&gt;CommandID&lt;/strong&gt; instance. Line 13 entitles the menu command service to handle events related to the command. The result of this short initialization code is that your package handles the event when the user clicks the Simple Message menu item in the Tools menu by executing the &lt;strong&gt;MenuItemCallback&lt;/strong&gt; method. In the next chapter you will find all nitty-gritty details about the command handling concepts used in Visual Studio and there you will learn much more about the initialization approach used here.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;MenuItemCallback&lt;/strong&gt; method uses the &lt;strong&gt;IVsUIShell&lt;/strong&gt; service to pop up a message box from within the IDE.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410292"&gt;&lt;/a&gt;&lt;a name="_Toc224959887"&gt;&lt;/a&gt;Registration Attributes&lt;/h3&gt;  &lt;p&gt;By now you know that packages are registered with Visual Studio in order to support the on-demand loading mechanism and allow merging menus and toolbars into the user interface of the IDE. The information to be registered is created during the build process from attributes assigned to the package class:&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:08e5a3c4-3799-4a1c-8276-2891bc740a5d" 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:#ffffd5;margin:0 0 0 2em;padding:0 0 0 5px;"&gt; &lt;li&gt;[&lt;span style="color:#2b91af;"&gt;PackageRegistration&lt;/span&gt;(UseManagedResourcesOnly = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;)]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;[&lt;span style="color:#2b91af;"&gt;InstalledProductRegistration&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;#110&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;#112&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;, IconResourceID = 400)]&lt;/li&gt; &lt;li&gt;[&lt;span style="color:#2b91af;"&gt;ProvideMenuResource&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;Menus.ctmenu&amp;quot;&lt;/span&gt;, 1)]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;[&lt;span style="color:#2b91af;"&gt;Guid&lt;/span&gt;(GuidList.guidFirstLookPkgString)]&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;sealed&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FirstLookPackage&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Package&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Package body omitted&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Packages are COM objects and so they must have a GUID uniquely identifying them. The &lt;strong&gt;Guid&lt;/strong&gt; attribute is used by the .NET framework to assign this GUID value to a type. All attributes above except &lt;strong&gt;Guid&lt;/strong&gt; are derived from the &lt;strong&gt;RegistrationAttribute&lt;/strong&gt; class which is the abstract root class for all attributes taking a role in package registration. Table 3 describes the attributes decorating the &lt;strong&gt;FirstLookPackage&lt;/strong&gt;:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Table 3&lt;/strong&gt;: &lt;em&gt;Registration attributes in FirstLookPackage&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;   &lt;table cellspacing="0" cellpadding="2"&gt;       &lt;tr&gt;         &lt;td&gt;&lt;strong&gt;Source File&lt;/strong&gt;&lt;/td&gt;          &lt;td&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;PackageRegistration&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;Adding this attribute to a class, the build process will handle it as a package and looks for other attributes to prepare the package registration according to your intention. In the example this attribute sets the &lt;strong&gt;UseManagedResourcesOnly&lt;/strong&gt; flag to tell that all resources used by the package are described in the managed package and not in a satellite DLL.&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;InstalledProductRegistration&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;This attribute is responsible to provide information to be displayed in the Help|About dialog in the IDE. The constructor of this attribute requires four arguments with the following meanings:            &lt;ul&gt;             &lt;li&gt;The first and second strings provide the name and the description of the package. The “#” characters indicate that these values should be looked up in the package resources with the IDs following “#”. &lt;/li&gt;              &lt;li&gt;The third “1.0” parameter is the product ID (version number). &lt;/li&gt;              &lt;li&gt;The fourth parameter (&lt;strong&gt;IconResourceID&lt;/strong&gt;) tells which icon to use for the package. &lt;/li&gt;           &lt;/ul&gt; All resources (name, description and icon) should be defined in the VSPackage.resx file. &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td&gt;&lt;em&gt;ProvideMenuResource&lt;/em&gt;&lt;/td&gt;          &lt;td&gt;This attribute is to create registry entries about menu and toolbar items provided by the package. Visual Studio uses the embedded resources here to merge the package menus into the Visual Studio menus.            &lt;br /&gt;The attribute has two parameters. The first is the so-called resourceID. This value is set to &lt;strong&gt;Menus.ctmenu&lt;/strong&gt; as during the build process the VSCT compiler uses this value by default when adding the binary representation of the .vsct file to the package resources. The second parameter is called versionID and it plays important role in the caching mechanism of resources. In the next chapter you are going to examine the role of this attribute in details.&lt;/td&gt;       &lt;/tr&gt;     &lt;/table&gt; &lt;/p&gt;  &lt;p&gt;There are many other registration attribute beside the ones in the table above, later in the book we are going to meet a few of them. You are not constrained to apply only the registration attributes defined by the Managed Package Framework, and you can define your own attributes. Any of them including yours are handled on the same way by the build process as the predefined ones.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410293"&gt;&lt;/a&gt;&lt;a name="_Toc224959888"&gt;&lt;/a&gt;The Command Table&lt;/h3&gt;  &lt;p&gt;The wizard generated a file named &lt;strong&gt;FirstLook.vsct&lt;/strong&gt;. It is an XML file and the file extension refers to the acronym coming from the “Visual Studio Command Table” expression. The schema of the XML file defines the command table owned by the package.&lt;/p&gt;  &lt;p&gt;The command table is transformed into a binary format during the build process and is embedded into the package assembly as a resource. During the registration phase the ID of this resource is put into the registry. When Visual Studio starts, loads this binary resource information and merges it with the menus of the IDE including toolbars and context menus.&lt;/p&gt;  &lt;p&gt;In order to avoid menu merges every time Visual Studio is launched, the IDE uses a cache mechanism and carries out the merge process only once for each package.&lt;/p&gt;  &lt;p&gt;The next chapter will treat this mechanism and the structure of the command table in details. Listing 2 shows you the command table described in the &lt;strong&gt;FirstLook.vsct&lt;/strong&gt; file.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Listing 2&lt;/strong&gt;: &lt;em&gt;FirstLook.vsct&lt;/em&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:21433d93-3dfa-462f-aa10-9922297239b3" 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:#ffffd5;margin:0 0 0 2.5em;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a31515;"&gt;xml&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;1.0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;encoding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;utf-8&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;?&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandTable&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;xmlns:xs&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;http://www.w3.org/2001/XMLSchema&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Extern&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;href&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;stdidcmd.h&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Extern&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;href&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;vsshlids.h&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Extern&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;href&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;msobtnid.h&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;package&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidFirstLookPkg&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Groups&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidFirstLookCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;MyMenuGroup&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;priority&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;0x0600&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Parent&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidSHLMainMenu&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;IDM_VS_MENU_TOOLS&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Group&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Groups&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Buttons&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidFirstLookCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdidShowMyMessage&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;priority&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;0x0100&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Button&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Parent&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidFirstLookCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;MyMenuGroup&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Icon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidImages&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPic1&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Strings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;cmdidShowMyMessage&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ButtonText&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Simple Message&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ButtonText&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Strings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Buttons&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Bitmaps&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Bitmap&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidImages&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;href&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Resources&amp;#92;Images_32bit.bmp&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;usedList&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPic1, bmpPic2, bmpPicSearch, bmpPicX, bmpPicArrows&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Bitmaps&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Commands&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Symbols&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GuidSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidFirstLookPkg&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;{&lt;span style="color:#0000ff;"&gt;d55758eb-6581-48fe-930b-f3536f43b6f0}&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GuidSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidFirstLookCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;{&lt;span style="color:#0000ff;"&gt;05da2180-8d8e-4822-913b-b6a9012c4b2b}&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;MyMenuGroup&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;0x1020&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdidShowMyMessage&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;0x0100&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GuidSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GuidSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidImages&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;{&lt;span style="color:#0000ff;"&gt;49ba23b3-1631-483d-a095-003cb157f55d}&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPic1&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;1&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPic2&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;2&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPicSearch&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;3&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPicX&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;4&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;IDSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;bmpPicArrows&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;5&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;GuidSymbol&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Symbols&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandTable&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;In this listing all comments placed into the generated file are omitted for saving space. However, it is worth to read those comments to have a better understanding of the command table structure.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;.vsct&lt;/strong&gt; file tells a lot about how Visual Studio is architected, how it solves the coupling of functions (commands) and user interface elements.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Commands (actions to execute) are separated from the user interface element triggering the command. The same command can be assigned to different menus and toolbars; they will use the same action. &lt;/li&gt;    &lt;li&gt;Commands used together can be grouped and simply merged into existing menus by using the command group representation. It is much easier then coupling commands with hosting menus one-by-one. &lt;/li&gt;    &lt;li&gt;Elements are identified by symbols rather than using explicit values. This makes the coupling less error-prone: values of symbols must be defined only once, and the VSCT compiler can check for mistyping. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The root element of a &lt;strong&gt;.vsct&lt;/strong&gt; file is the &lt;strong&gt;CommandTable&lt;/strong&gt; element. As you can see all related elements are defined by the &lt;em&gt;http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable&lt;/em&gt; namespace. No doubt, the most important element is &lt;strong&gt;Commands&lt;/strong&gt;, because this node defines commands, their initial layout and behavior.&lt;/p&gt;  &lt;p&gt;Any command in the VS IDE must belong to the IDE itself or to a package. To assign a command to the appropriate (owning) VSPackage, the package attribute of the &lt;strong&gt;Commands&lt;/strong&gt; element must name the GUID of the corresponding package. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Commands&lt;/strong&gt; node can have a few child elements; each has a very specific role. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Group&lt;/strong&gt; elements define so-called command groups; each of them is a logical set of related commands that visually stand together. In the &lt;strong&gt;FirstLook.vsct&lt;/strong&gt; file we have a &lt;strong&gt;Group&lt;/strong&gt; element that holds only a &lt;strong&gt;Button&lt;/strong&gt;. A button represents a piece of user interface element the user can interact with, in this case a menu item that can be clicked. The &lt;strong&gt;Parent&lt;/strong&gt; element defines the relationship between elements, for example the &lt;strong&gt;Button&lt;/strong&gt; element defined above is parented in the &lt;strong&gt;Group&lt;/strong&gt;.&lt;/p&gt;  &lt;p&gt;Toolbars and menus would be poor without icons helping the user to associate a small image with the function. The &lt;strong&gt;Bitmap&lt;/strong&gt; nodes allow defining the visual elements (icons) used in menus.&lt;/p&gt;  &lt;p&gt;The &lt;strong&gt;Symbols&lt;/strong&gt; section is a central place in the command table file where you can define the identifiers to be used in the other parts of the&lt;strong&gt; .vsct&lt;/strong&gt; file. You can use the &lt;strong&gt;GuidSymbol&lt;/strong&gt; element to define the “logical container GUID” and the nested &lt;strong&gt;IDSymbol&lt;/strong&gt; elements to provide (optional) identifiers within the logical container. The name and the value attribute of these elements do exactly what you expect: associate the symbol name with its value.&lt;/p&gt;  &lt;p&gt;The VSPackage Wizard put the generated GUID values into the&lt;strong&gt; FirstLook.vsct&lt;/strong&gt; file but they also can be found in the &lt;strong&gt;Guids.cs&lt;/strong&gt; file. The &lt;strong&gt;PkgCmdID.cs &lt;/strong&gt;file defines constant values for the &lt;strong&gt;IDSymbol&lt;/strong&gt; values used by package commands. These three files must be kept consistent, so if you change a GUID or a command identifier, the changes should be tracked in the other files as well; otherwise your package will not work as expected.&lt;/p&gt;  &lt;h3&gt;&lt;a name="_Toc234410294"&gt;&lt;/a&gt;&lt;a name="_Toc224959889"&gt;&lt;/a&gt;Package Resource Files&lt;/h3&gt;  &lt;p&gt;The &lt;strong&gt;FirstLook&lt;/strong&gt; project has two resource files:&lt;strong&gt; Resources.resx&lt;/strong&gt; and &lt;strong&gt;VSPackage.resx&lt;/strong&gt;. They both utilize the resource handling mechanism in the .NET Framework, but have different roles. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Resources.resx&lt;/strong&gt; is to store functional resources that are consumed by the objects and services of your package. For instance, you can store error messages, prompt strings, UI elements, logos, and so on in this resource file and access them programmatically through the static members of the Resources class generated by the &lt;strong&gt;ResXFileCodeGenerator&lt;/strong&gt; custom tool attached to the &lt;strong&gt;.resx&lt;/strong&gt; file.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;VSPackage.resx&lt;/strong&gt; can store resources just like &lt;strong&gt;Resources.resx&lt;/strong&gt;, but its primary role is to embed package infrastructure resources. This resource file does not use the &lt;strong&gt;ResXFileCodeGenerator&lt;/strong&gt; custom tool and so does not generate any helper class to access resources. &lt;/p&gt;  &lt;p&gt;As you remember the package is decorated with the &lt;strong&gt;InstalledProductRegistration&lt;/strong&gt; attribute which refers to resource identifiers 110, 112 and 400:&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:3d6dd13c-923c-4c22-b6b4-8eb2c7aaf3ef" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;[&lt;span style="color:#2b91af;"&gt;InstalledProductRegistration&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;#110&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;#112&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;, IconResourceID = 400)]&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;These IDs refer to string and icon resources in the &lt;strong&gt;VSPackage.resx&lt;/strong&gt; file as shown in Figure 12.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0312_5F00_1ADD865B.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0312" border="0" alt="f0312" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0312_5F00_thumb_5F00_41AB9C9B.png" width="660" height="225" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 12&lt;/strong&gt;: &lt;em&gt;String resources in VSPackage.resx&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Package resources will be extracted from the content of the &lt;strong&gt;VSPackage.resx&lt;/strong&gt; file, so if you put them in the &lt;strong&gt;Resources.resx&lt;/strong&gt; file, the package will not find the resource. Although you can put functional resources into &lt;strong&gt;VSPackage.resx&lt;/strong&gt; file, their recommended place is the&lt;strong&gt; Resources.resx&lt;/strong&gt; file.&lt;/p&gt;  &lt;h2&gt;&lt;a name="_Toc234410295"&gt;&lt;/a&gt;&lt;a name="_Toc224959890"&gt;&lt;/a&gt;The Package Build Process&lt;/h2&gt;  &lt;p&gt;Understanding the package build process can help a lot when you are about to debug or deploy your application. In this part you’ll learn the steps of this process in details. &lt;/p&gt;  &lt;p&gt;Building a package is not simply compiling the package source code into a .NET assembly. There are other important steps to complete in order to use the package either in the Experimental Instance or in its productive environment.&lt;/p&gt;  &lt;p&gt;When the wizard generates the package it adds new build targets to the &lt;strong&gt;.csproj&lt;/strong&gt; file of the corresponding class library. You can discover these entries by first unloading the project and then editing the project file. If you want to try it, first right-click on the project file in Solution Explorer and use the Unload Project function, then activate the Edit FirstLook.csproj command also with right-click. When you scroll down to the bottom of the file you can discover the following entries:&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:a36bff8d-bbd7-445f-a039-8048cd64bfe9" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&amp;lt;Import Project=&lt;span style="color:#a31515;"&gt;&amp;quot;$(MSBuildBinPath)&amp;#92;Microsoft.CSharp.targets&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;lt;Import Project=&lt;span style="color:#a31515;"&gt;&amp;quot;$(MSBuildExtensionsPath)&amp;#92;Microsoft&amp;#92;VisualStudio&amp;#92;v10.0&amp;#92;VSSDK&amp;#92;\uinput1?&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;Microsoft.VsSDK.targets&lt;span style="color:#a31515;"&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The first Import entry can be found in any C# language projects to invoke the C# compiler and all the other tools (for example the resource compiler) to create the assemblies from the source project. The second Import entry is the one added by the VSPackage Wizard. The .targets file specified here contains Visual Studio SDK related build targets. If you would like to have a look at this file, you can find it in the &lt;em&gt;MSBuild\Microsoft\VisualStudio\v10.0\VSSDK&lt;/em&gt; folder under Program Files. This book is not about MSBUILD, so you won’t find more explanations about what the build targets describe and how they internally work, instead, here are the steps of the package build process:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The Resources.resx and VSPackage.resx files are compiled into the corresponding .resource files. &lt;/li&gt;    &lt;li&gt;With the help of the vsct.exe utility the content of the .vsct file belonging to the package is compiled into a binary file called CTO file. This file format is used by Visual Studio when merging the package menu and command information into the IDE menu. &lt;/li&gt;    &lt;li&gt;The CTO file is merged into the VSPackage.resource file as a binary resource with the name of Menus.ctmenu. &lt;/li&gt;    &lt;li&gt;The C# compiler is invoked to compile the project source code just like normally when we build a standard class library. During this step the Resources.resources file and the VSPackage.resources files are embedded into the assembly. &lt;/li&gt;    &lt;li&gt;The CreatePkgDef.exe utility is executed and it scans the assembly for registration metadata information. Each registration attribute is translated to corresponding registry data. The utility is parameterized so that it creates a .pkgdef text file containing the information that is to be entered into the system registry. &lt;/li&gt;    &lt;li&gt;The binaries of the package (including the .dll and .pdb file), the corresponding .pkgdef file and the VSIX manifest file are zipped into a file with .vsix extension. This .vsix file is the installation kit of the package. You will find this file just beside the binaries (in the bin\Debug or bin\Release or maybe in another folder depending on the build configuration). With double clicking on this file you can start the Visual Studio Extension Installer utility. &lt;/li&gt;    &lt;li&gt;The .vsix file is installed in your LocalAppData folder under the Extensions subfolder of the Visual Studio Experimental Instance. The location of this folder depends on your user account and profile type. For example, if your user name is jsmith, you have installed Windows 7 on your C: drive and you have a local profile the build process will look for the &lt;em&gt;C:\Users\jsmith\AppData\Local\Microsoft\VisualStudio&lt;/em&gt; folder and install the .vsix file under the&lt;em&gt; 10.0Exp\Extensions&lt;/em&gt; subfolder. The extension will be enabled (setting a key in the registry). &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;As a result of the build process the package is available in the Experimental Instance. The next time you start the Experimental Instance, it scans the Extensions folder, uses the .pkgdef file of your package to create the appropriate registry settings, the package’s menus gets merged into the IDE, so your package is ready to run.&lt;/p&gt;  &lt;h2&gt;&lt;a name="_Toc234410296"&gt;&lt;/a&gt;&lt;a name="_Toc224959891"&gt;&lt;/a&gt;Debugging Visual Studio Packages&lt;/h2&gt;  &lt;p&gt;Anyone who develops software creates programming mistakes. Majority of them can be caught during a simple or more complex code review. Many of them are obvious and you can find them in the code after observing the faulty behavior. There are a few of them which cannot be easily caught without using a debugger.&lt;/p&gt;  &lt;p&gt;Developing VSPackages is the same story. Sooner or later you find yourself debugging a package and searching for a bug. This book does not want to go into details about debugging techniques; this is definitely not its topic. However, you will learn how easy is to debug your package and what is going behind the scenes.&lt;/p&gt;  &lt;p&gt;To debug or run a package you should set it as the startup project. If your package is the only project is the solution, it is already marked so. If you have more projects in the solution, you should mark any VSPackage project as the startup project.&lt;/p&gt;  &lt;p&gt;Independently if you run a package with or without debugging, the Visual Studio Experimental Instance is started. You can check it on the project property pages on the Debug tab as Figure 13 shows it for the FirstLook project.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0313_5F00_3A8C6023.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0313" border="0" alt="f0313" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0313_5F00_thumb_5F00_1A715366.png" width="629" height="500" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 13&lt;/strong&gt;: &lt;em&gt;Debug properties&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;You can see that devenv.exe is selected as the startup project and it is launched with the&lt;strong&gt; /rootsuffix Exp&lt;/strong&gt; command line parameters. As you have learnt before this command line starts the Experimental Instance.&lt;/p&gt;  &lt;p&gt;When you start the project with the Start Debugging (F5) function Visual Studio attaches the debugger to the Experimental Instance and so you can set breakpoints in Visual Studio. As your package running in the Experimental Instance reaches a breakpoint, you are taken back to the debug view as Figure 14 illustrates it. In this case a breakpoint was set within the Initialize method of the &lt;strong&gt;FirstLookPackage&lt;/strong&gt; class.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0314_5F00_6564C435.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0314" border="0" alt="f0314" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0314_5F00_thumb_5F00_73370A30.png" width="611" height="500" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 14&lt;/strong&gt;: &lt;em&gt;The debugger in action&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;You can use the same techniques for debugging a VSPackage as for any other applications. All debugging features of Visual Studio are accessible: you can watch variables, evaluate expressions, set up conditional breakpoints, and so on.&lt;/p&gt;  &lt;p&gt;There are cases when you would like to trace your application without a debugger using trace messages. You can follow this practice with Visual Studio. The simplest one is writing to the Debug pane of the Output window. You can learn about this topic in Chapter 3.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;h2&gt;&lt;a name="_Toc234410297"&gt;&lt;/a&gt;&lt;a name="_Toc224959892"&gt;&lt;/a&gt;Deploying a Package&lt;/h2&gt;  &lt;p&gt;It is very comfortable to use the Experimental Instance while developing a package. The build process takes care about setting up your package to work, so you can use either the Start Debugging or Start Without Debugging commands to try what you’ve created. However, when your package is ready for distribution you should care about deployment questions.&lt;/p&gt;  &lt;h3&gt;Package Deployment in the Past&lt;/h3&gt;  &lt;p&gt;With Visual Studio versions preceding 2010 developers had to do some extra activities to prepare packages for deployment and it has a few potential pitfalls. The two main issues were that you needed to obtain a so-called Package Load Key (PLK) through a web page and take care of entering the required entries into the registry to allow Visual Studio recognize and integrate your package.&lt;/p&gt;  &lt;p&gt;¾ Any change in package information like name, GUID, company or version required obtaining a new PLK. The Experimental Hive (this is what is now called Experimental Instance) did not check the PLK by default, so it often happened that developers faced with a wrong (missing or not renewed) PLK only after the installation kit was built and tested in the production Visual Studio environment.&lt;/p&gt;  &lt;p&gt;¾ While the build process automatically registered the package under the Experimental Hive, developers had to create their own registration mechanism in the installation kit. It was not difficult, but because it was not automatic, forgotten registration updates could have led to annoying issues.&lt;/p&gt;  &lt;h3&gt;The VSIX installation&lt;/h3&gt;  &lt;p&gt;The new deployment mechanism built into Visual Studio 2010 removes this pain and provides an easy and straightforward way for package deployment.&lt;/p&gt;  &lt;p&gt;Generally the easiest form of deploying an artifact is if you have an installation kit. The package build process as treated earlier creates this installation kit as a .vsix file containing the package binaries and some additional information. You can distribute your package by simply distributing the .vsix file to your customers. When they receive it, the Visual Studio Extension Installer utility can be started with double clicking on the .vsix file as Figure 15 illustrates.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0315_5F00_12E5E3F9.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0315" border="0" alt="f0315" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0315_5F00_thumb_5F00_72CAD73B.png" width="480" height="364" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 15&lt;/strong&gt;: &lt;em&gt;Installing a VSIX file&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;When you click install the content of the VSIX file will be installed to the specified Visual Studio instance.&lt;/p&gt;  &lt;p&gt;If you create a package for a broad set of customers or for the community, you can upload the VSIX file to the Visual Studio Gallery. The new Shell of Visual Studio contains a great tool called Extension Manager that is able to search this gallery for extensions, install or remove them, and keep track of installed extensions as well as managing their updates. Figure 16 shows a screenshot of the Extension Manager browsing the extensions available on Visual Studio Gallery.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0316_5F00_52AFCA7E.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="f0316" border="0" alt="f0316" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/f0316_5F00_thumb_5F00_648C5E4B.png" width="660" height="407" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Figure 16&lt;/strong&gt;: &lt;em&gt;Browsing Visual Studio Gallery with the Extension Manager&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;You can select any of the components while browsing, and on the right pane of the window you find some more details about the highlighted item. With the More Information link you will be directed to component’s home page on the Visual Studio Gallery. If you like this component, you can get it with the Download button just as others can obtain your uploaded components. The Extension Manager is the recommended way to obtain extensions. Because it runs within a Visual Studio instance, you can use it to install a separate set of components for your development environment and for the Experimental Instance. When using the Visual Studio Extension Installer utility your components will be installed under the normal development environment by default. &lt;/p&gt;  &lt;p&gt;It was mentioned earlier that the build process packages the binaries and some other files into the VSIX file. In order the installation process could understand your .vsix installation file you need to create a so-called VSIX manifest file that is the soul of the installation kit. This file describes the metadata that is used as the set of instructions about what, where and how should be put during the setup. The VSPackage Wizard automatically creates this manifest for you and names the file as source.extension.vsixmanifest. You are probably not surprised that the manifest is an XML file with its own schema. When the FirstLook package was generated the wizard created the manifest shown in Listing 3:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Listing 3&lt;/strong&gt;: &lt;em&gt;source.extension.vsixmanifest&lt;/em&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:949cde0d-2ec1-4331-9c9b-15cc387bbd83" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color:#a31515;"&gt;xml&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;1.0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;encoding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;utf-8&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;?&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Vsix&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;1.0.0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;http://schemas.microsoft.com/developer/vsx-schema/2010&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Identifier&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;d55758eb-6581-48fe-930b-f3536f43b6f0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;FirstLook&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Author&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;DeepDiver&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Author&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;1.0&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Description&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;xml:space&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;preserve&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Demonstrates the basic VSPackage concepts&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Description&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Locale&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;1033&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Locale&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;InstalledByMsi&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;false&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;InstalledByMsi&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SupportedProducts&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;VisualStudio&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Version&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;10.0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Edition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Pro&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Edition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;VisualStudio&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SupportedProducts&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;SupportedFrameworkRuntimeEdition&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;MinVersion&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;4.0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;MaxVersion&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;4.0&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Identifier&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;References&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;References&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Content&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;VsPackage&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;|FirstLook;PkgdefProjectOutputGroup|&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;VsPackage&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Content&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Vsix&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The root element of the manifest structure is the VSIX element that uses the &lt;em&gt;http://schemas.microsoft.com/developer/vsx-schema/2010 &lt;/em&gt;namespace. The manifest contains three sections:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Identifier&lt;/strong&gt; is used to uniquely define the different installation packages. The information here is used by the setup mechanism to manage the initial setup and the updates using the &lt;strong&gt;Id&lt;/strong&gt; attribute and &lt;strong&gt;Version&lt;/strong&gt; element values. This section also contains information describing the package and attributes taken into account during the setup process. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;References&lt;/strong&gt; element contains a collection of dependencies. Each item is a &lt;strong&gt;Reference&lt;/strong&gt; element which defines a dependency on another product. In the FirstLook.vsix sample the package contains one dependency. &lt;/li&gt;    &lt;li&gt;The &lt;strong&gt;Content&lt;/strong&gt; element is a collection of content items that are packed in the payload. It our case the content is a VSPackage where the value of the item is used to generate the .pkgdef file containing the package information. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;When running the Visual Studio Extension Installer or using the Extension Manager, the VSIX manifest is used to determine how the VSIX package should be set up. The VSPackage content type tells the installer that the related FirstLook.pkgdef file will contain the information to be put into the registry in order to register the COM object representing a Visual Studio package. The FirstLook.pkgdef file that has been created during the build process contains the information in Listing 4:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Listing 4&lt;/strong&gt;: &lt;em&gt;FirstLook.pkgdef&lt;/em&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:16cbe7ab-519e-483a-b216-ec6e6f03e074" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;[$RootKey$&amp;#92;InstalledProducts&amp;#92;FirstLookPackage]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;@=&amp;quot;#110&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;Package&amp;quot;=&amp;quot;{d55758eb-6581-48fe-930b-f3536f43b6f0}&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;PID&amp;quot;=&amp;quot;1.0&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;ProductDetails&amp;quot;=&amp;quot;#112&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;LogoID&amp;quot;=&amp;quot;#400&amp;quot;&lt;/li&gt; &lt;li&gt;[$RootKey$&amp;#92;Packages&amp;#92;{d55758eb-6581-48fe-930b-f3536f43b6f0}]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;@=&amp;quot;DeepDiver.FirstLook.FirstLookPackage, FirstLook, Version=1.0.0.0, Culture=neutral, PublicKeyToken=8e5c6425e9b83cf4&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;InprocServer32&amp;quot;=&amp;quot;$WinDir$&amp;#92;SYSTEM32&amp;#92;MSCOREE.DLL&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;Class&amp;quot;=&amp;quot;DeepDiver.FirstLook.FirstLookPackage&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;CodeBase&amp;quot;=&amp;quot;$PackageFolder$&amp;#92;FirstLook.dll&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;[$RootKey$&amp;#92;Menus]&lt;/li&gt; &lt;li&gt;&amp;quot;{d55758eb-6581-48fe-930b-f3536f43b6f0}&amp;quot;=&amp;quot;, Menus.ctmenu, 1&amp;quot;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The content of this file resembles to the content of a .reg file that can be exported from or imported to the Windows registry. However, the .pkgdef file contains a few tokens closed between dollar signs. The values of these tokens are passed by the context of the .pkgdef file to the entity processing the file content.&lt;/p&gt;  &lt;p&gt;For example, if you use the Visual Studio Extension Installer utility to process the .vsix file, the utility extracts the payload into the &lt;em&gt;Microsoft\VisualStudio\10.0\Extensions &lt;/em&gt;subfolder under the &lt;em&gt;LocalAppData&lt;/em&gt; folder of your user profile. The files are put not directly into the Extension folder but into the subfolder calculated from the &lt;strong&gt;Author&lt;/strong&gt;, &lt;strong&gt;Name&lt;/strong&gt; and &lt;strong&gt;Version&lt;/strong&gt; elements of the manifest’s Identity section. In this case the payload includes the FirstLook.pkgdef and FirstLook.dll files beside a few others.&lt;/p&gt;  &lt;p&gt;When Visual Studio starts, it recognizes that a new .pkgdef file is under the Extensions folder and processes it. It substitutes the &lt;strong&gt;$RootKey$&lt;/strong&gt; token with the corresponding registry root of Visual Studio 2010,&lt;strong&gt; $Windir$&lt;/strong&gt; with the current Windows installation folder,&lt;strong&gt; $PackageFolder$&lt;/strong&gt; with the encapsulating folder of the .pkgdef file. After Visual Studio startup finishes, all information required to find and load the package is entered into the registry. When the first action demanding the package is executed, Visual Studio can pick up and initialize it.&lt;/p&gt;  &lt;h2&gt;&lt;a name="_Toc234410298"&gt;&lt;/a&gt;&lt;a name="_Toc224959896"&gt;&lt;/a&gt;Summary&lt;/h2&gt;  &lt;p&gt;A VSPackage is the principal architectural unit of Visual Studio, a container for extensibility objects. It is also a unit from deployment, security and licensing aspects. Packages are not loaded immediately as Visual Studio starts, they are read into the memory on-demand at the first time when any of their objects or services is about to be used.&lt;/p&gt;  &lt;p&gt;The process of integrating a package physically into the Shell is called siting. While the package is not sited, its functions cannot be used from outside. As soon as the package gets sited, it is ready to finish its initialization and be fully functional. Siting happens when Visual Studio loads the package.&lt;/p&gt;  &lt;p&gt;Visual Studio keeps track of packages installed through registration, and package information is stored in the system registry under a specific Visual Studio key. With command line parameters this registration key can be suffixed in order to use another configuration set — even with separate package registration parameters.&lt;/p&gt;  &lt;p&gt;The Visual Studio SDK sets up the Visual Studio Experimental Instance which is a test bed to run and debug Visual Studio packages during the development and test phases. The Experimental Instance is not a separate Visual Studio installation, it uses the same devenv.exe file but with different configuration settings.&lt;/p&gt;  &lt;p&gt;VSPackages use a build process that contains some additional steps in order to prepare the packages for debugging or deployment. The easiest way to create a package is running the VSPackage Wizard which sets up the build process appropriately. During this process package infrastructure resources — like to so-called command table — are embedded into the package assembly, the package installation kit is created and installed under the Experimental Instance.&lt;/p&gt;  &lt;p&gt;During the development phase packages run inside the process space of the Experimental Instance and the same debug techniques can be used for tracing and troubleshooting as for any other .NET applications.&lt;/p&gt;  &lt;p&gt;VSPackage deployment in Visual Studio 2010 became really simple related to the preceding versions. The package installation kit is represented by a VSIX file that can be distributed directly to the users of your package or — and this way opens up brand new opportunities — uploaded to the Visual Studio Gallery. The Extension Manager built into the IDE can be used to browse, install, and remove VSPackages (and many other kinds of extensions) as well as to keep track of them.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1926" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>VS 2010 and .NET 4 Six-In-One: My last chapter submitted today…</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/12/22/vs-2010-and-net-4-six-in-one-my-last-chapter-submitted-today.aspx" /><id>/blogs/divedeeper/archive/2009/12/22/vs-2010-and-net-4-six-in-one-my-last-chapter-submitted-today.aspx</id><published>2009-12-22T13:08:53Z</published><updated>2009-12-22T13:08:53Z</updated><content type="html">&lt;p&gt;A few weeks ago &lt;a href="http://dotneteers.net/blogs/divedeeper/archive/2009/09/26/VS2010Net4SixInOne.aspx"&gt;I shared the news&lt;/a&gt; with you that the Dotneteers team works on a book with an authoring team including other community members. Today I submitted my last (seventh) chapter dealing with the core enhancements of the .NET 4.0 Framework. The book is available on &lt;a href="http://www.amazon.com/Visual-Studio-2010-NET-Six/dp/0470499486/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1259555648&amp;amp;sr=8-1"&gt;Amazon&lt;/a&gt; you can already preorder it. Visual Studio 2010 and .NET 4 Six-In-One will be published around Visual Studio 2010 launch time. Here is the short table of contents:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Chapter 1: History of Visual Studio and Current Editions&lt;/li&gt;    &lt;li&gt;Chapter 2: VS UI Enhancements&lt;/li&gt;    &lt;li&gt;Chapter 3: Visual Studio Snippets&lt;/li&gt;    &lt;li&gt;Chapter 4: Visual Studio Templates&lt;/li&gt;    &lt;li&gt;Chapter 5: Getting the most out of the IDE&lt;/li&gt;    &lt;li&gt;Chapter 6: Extending Visual Studio&lt;/li&gt;    &lt;li&gt;Chapter 7: .NET Framework Version History&lt;/li&gt;    &lt;li&gt;Chapter 8: Window Presentation Foundation WPF&lt;/li&gt;    &lt;li&gt;Chapter 9: Windows Communication Foundation&lt;/li&gt;    &lt;li&gt;Chapter 10: Enhancements to the .NET Core Framework&lt;/li&gt;    &lt;li&gt;Chapter 11: Enhancements to the .NET Workflow Framework&lt;/li&gt;    &lt;li&gt;Chapter 12: Enhancements to the .NET Data Framework&lt;/li&gt;    &lt;li&gt;Chapter 13: Enhancements to the .NET Communication Framework&lt;/li&gt;    &lt;li&gt;Chapter 14: Enhancements to the .NET Client Framework&lt;/li&gt;    &lt;li&gt;Chapter 15: .NET Charting Components&lt;/li&gt;    &lt;li&gt;Chapter 16: ASP.NET Version History&lt;/li&gt;    &lt;li&gt;Chapter 17: ASP.NET Charting Controls&lt;/li&gt;    &lt;li&gt;Chapter 18: ASP.NET Dynamic Data&lt;/li&gt;    &lt;li&gt;Chapter 19: ASP.NET MVC&lt;/li&gt;    &lt;li&gt;Chapter 20: ASP.NET Ajax Improvements&lt;/li&gt;    &lt;li&gt;Chapter 21: Ajax Control Toolkit, jQuery and More&lt;/li&gt;    &lt;li&gt;Chapter 22: Visual Basic History&lt;/li&gt;    &lt;li&gt;Chapter 23: Visual Basic 10 Language Improvements&lt;/li&gt;    &lt;li&gt;Chapter 24: C# History&lt;/li&gt;    &lt;li&gt;Chapter 25: C# 4 Language Improvements&lt;/li&gt;    &lt;li&gt;Chapter 26: Other .NET Languages&lt;/li&gt;    &lt;p&gt;&lt;/p&gt; &lt;/ul&gt;  &lt;p&gt;However the book focuses on new features in VS 2010 and .NET 4, even those who use .NET 1.1 or VS 2005 right now may find it useful.&lt;/p&gt;  &lt;p&gt;In the next few weeks you can read more details of the book, so stay tuned!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1644" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>PDC 2009 Keynote – Tuesday</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/11/17/pdc-2009-keynote-tuesday.aspx" /><id>/blogs/divedeeper/archive/2009/11/17/pdc-2009-keynote-tuesday.aspx</id><published>2009-11-17T15:52:08Z</published><updated>2009-11-17T15:52:08Z</updated><content type="html">&lt;p&gt;After 2008 Microsoft organized a PDC again without waiting for two or more years, as it usually happened in the past. Right now I’m setting here in the main auditorium of Los Angeles Convention Center and watching this years keynote. Well, people around my typing on their notebooks, writing their blogs or twitting about what they see and hear.&lt;/p&gt;  &lt;p&gt;Yesterday the first new thing happened, even before any official announcement, Microsoft Office 2010 Beta went to the MSDN Download Center. I’ve already started downloading it…&lt;/p&gt;  &lt;p&gt;A short summary about what kind of messages I’ve got during this keynote:&lt;/p&gt;  &lt;p&gt;Ray Ozzie, Chief Software Architect&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows Azure: One coherent model using Windows Server and System Center. Tools for developers: Windows Azure tools for Java and Eclipse, PHP application support &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Guest: Matt Mullenweg, Automaitc, manufacturer of WordPress:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Now WordPress works on Azure (oddlyspecific.com as one example) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Guest: Loic LeMear, Seesmic&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Created Silverlight prototype for a new Twitter browser. Easy to use with user lists, custom-defined columns. They are going to create a platform around this app allowing plug-in development. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Ray Ozzie, Chief Software Architect&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Announcement: Microsoft PinPoint for finding online Sharepoint and Exchange applications and other solutions &lt;/li&gt;    &lt;li&gt;Announcment: Microsoft Codename “Dallas” CTP, creating a uniform access and discovery for data, Data-as-a-Service &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Don Box, Chriss Sells:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;C++ code runs on Windows Azure, they demonstrated it. &lt;/li&gt;    &lt;li&gt;SQL Azure is easy, SQL Management Studio 2008 R2 supports it. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Bob Muglia, President, Server and Tools Business&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Announcement: Your enterprise services connected to Windows Azure, code name&amp;#160; “Project Sydney” &lt;/li&gt;    &lt;li&gt;Announcement: Windows Azure Virtual Machine Role &lt;/li&gt;    &lt;li&gt;Announcement: Windows Azure AppFabric (Caching, Workflow Hosting, Monitoring)&lt;/li&gt;    &lt;li&gt;Announcement: Windows Identity Foundation RTM&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Cameron Skinner:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Demos Azure development support with VS 2010 (AppFabric, WIF)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you can, watch the PDC Keynote video you can access from &lt;a href="http://microsoftpdc.com/"&gt;here.&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1434" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>Visual Studio 2010 Beta2: Nice logo with no accessibility respect?</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/22/visual-studio-2010-nice-logo-with-no-accessibility-respect.aspx" /><id>/blogs/divedeeper/archive/2009/10/22/visual-studio-2010-nice-logo-with-no-accessibility-respect.aspx</id><published>2009-10-22T20:59:16Z</published><updated>2009-10-22T20:59:16Z</updated><content type="html">&lt;p&gt;I really like the new sexy design of MSDN and Visual Studio, both colors and form. The new logo suggests me that now Visual Studio is not a tool that roughly integrates separate development assets but rather a really integrated and uniform development tool for .NET. There are places where the logo is very impressive and looks really great, let me show a few:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/logo_5F00_093551A4.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="logo" border="0" alt="logo" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/logo_5F00_thumb_5F00_7EB47D83.png" width="267" height="54" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1D1EBE6D.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_653C547C.png" width="343" height="73" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_3C513F73.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_5A4F4D67.png" width="365" height="76" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;However, the nice Möbius strip does not look nice on the Windows 7 taskbar:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_5B31A95E.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_32469455.png" width="309" height="104" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Compared to the light shape of the Visual Studio 2008 icon, the new one is modest, but the biggest issue is that you can hardly recognize it is there. The situation is a bit better when VS 2010 is started, the lighter background helps a bit:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_107ABBC4.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_3CB742A8.png" width="304" height="98" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;However, when you compare it to the VS 2008 icon, you can see, it is far away from being great and highlighted.&lt;/p&gt;  &lt;p&gt;I would not say that this logo intentionally is bad from accessibility point of view, I rather suspect, the designer (or anyone else) never tried it using over a dark background like the Windows 7 taskbar. I’m not a designer or a UX person, but I guess adding a white border around the icon would help a lot.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1314" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author><category term="VS 2010" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VS+2010/default.aspx" /></entry><entry><title>DevTools Ecosystem Summit: Best Practices for Extending the IDE with a Focus on Performance, Part 3</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/22/devtools-ecosystem-summit-best-practices-for-extending-the-ide-with-a-focus-on-performance-part-3.aspx" /><id>/blogs/divedeeper/archive/2009/10/22/devtools-ecosystem-summit-best-practices-for-extending-the-ide-with-a-focus-on-performance-part-3.aspx</id><published>2009-10-22T15:19:59Z</published><updated>2009-10-22T15:19:59Z</updated><content type="html">&lt;p&gt;&lt;a title="Best Practices for Extending the IDE with a Focus on Performance, Part 2" href="http://dotneteers.net/blogs/divedeeper/archive/2009/10/20/DevToolEcosystemSummitVSX202Part2.aspx"&gt;&amp;lt;Part 2&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_7D1EAD1B.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_79BD1573.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;In the last section of my presentation I would like to show you common mistakes or pitfalls, and try to give you a few tips to cope with them.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;One of the most difficult issues to solve is when package load failures occur. The main reasons why these issues occur are generally &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;exceptions in Initialize or&lt;/font&gt;&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;Loading failure of a referenced assembly, generally because the assembly is not on the probing path of Visual Studio.&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;This kind of errors are very annoying, because prevent any functions of our package working. Because packages are loaded on-demand by default, we can face package initialization issues unexpectedly.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;VS 2008 does not leverages on WPF technology. With VS 2010 you can compile packages using WPF tool windows successfully, but when you try to show them, their caption is visible but the client area does not show up.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;The Visual Studio Command Table files (.vsct) also can have traps you can walk into. You can easily write a VSCT that compiles well, but does not show up your commands, because it has some semantic issues.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;I also would like to show you, how you can trace your packages to get some diagnostic information for troubleshooting.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_770AEFE3.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_553F1752.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;Let’s start to walk into a few traps…&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;I modify the &lt;font face="cons"&gt;&lt;strong&gt;Initialize&lt;/strong&gt;&lt;/font&gt; method of the &lt;font face="consol"&gt;&lt;strong&gt;CSharpStats&lt;/strong&gt;&lt;/font&gt; package so that it tries to use a service before that service has been initialized, and so causes a &lt;font face="cons"&gt;&lt;strong&gt;NullReferenceException&lt;/strong&gt;&lt;/font&gt;.&lt;/span&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:ed4d1d82-1783-4f41-b1b0-8c134ba7fd37" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Initialize()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.Initialize();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- This will fail:&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; csharpSrv = GetService(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;SCSharpStats&lt;/span&gt;)) &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ICSharpStats&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;csharpSrv.GetCSharpFiles();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Proffer the service instance&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; serviceContainer = &lt;span style="color:#0000ff;"&gt;this&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IServiceContainer&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;serviceContainer.AddService(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;SCSharpStats&lt;/span&gt;), &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CSharpStatsService&lt;/span&gt;(), &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;);&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;When we build and run the package and want to display the C# Statistics window, we have a package load failure message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1497934A.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_6016C101.png" width="516" height="339" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;With the help of the debugger you can find the source of this error. Answering with Yes to this question means that you will see the error message continuously when Visual Studio tries to load your package. However clicking on now will suppress this message and what we see is only that tool window does not show up. We do not see that it is a package load failure! Start the package with debugging to catch the source of the issue!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_76F5927D.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_335DE15B.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The debugger stops at the code line raising an exception, and we can see which code line is responsible to prevent our package load. However, we are not also as lucky as in this case. Visual Studio has a so-called activity log where VS puts diagnostics messages. This log is turned off by default, but you can turn it on with the &lt;font face="cons"&gt;&lt;strong&gt;/log&lt;/strong&gt;&lt;/font&gt; command line switch. To debug your package with the Experimental Instance, you have to change your project’s debug properties:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_30D4AF9D.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_07E99A94.png" width="652" height="500" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When running our faulty package again, we can look into the log file. This file can be found under your roaming profile in the &lt;font face="cons"&gt;&lt;strong&gt;Microsoft\VisualStudio\10.0Exp&lt;/strong&gt;&lt;/font&gt; folder. In this file we can see that our package failed to load.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1D82ECDB.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_50064A4D.png" width="660" height="351" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;We can put our own messages into the activity log, CSharpStats also does it at the end of the Initialize method:&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:e1b76343-d2d6-49db-be6d-6936ae12f8b2" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; refreshCommandID = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CommandID&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;GuidList&lt;/span&gt;.guidCSharpStatsCmdSet,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;(&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;PkgCmdIDList&lt;/span&gt;.cmdidRefreshCSharpStats);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; menuRefresh = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;MenuCommand&lt;/span&gt;(RefreshStats, refreshCommandID);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;mcs.AddCommand(menuRefresh);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Log initialization success&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;ActivityLog&lt;/span&gt;.Write(&lt;span style="color:#a31515;"&gt;&amp;quot;CSharpStats&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;Package initialization done.&amp;quot;&lt;/span&gt;);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Now, when we delete the two fake lines preventing our package to load, and run the package again, the activity log shows our package gets loaded.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_474A3D0D.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_0FB47C1F.png" width="660" height="349" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can also discover messages the C# Statistics tool window put into the log.&lt;/p&gt;  &lt;p&gt;Now, let’s examine a new potential issue that is new in VS 2010, and it is related to WPF tool windows. You can put semantic mistakes into the XAML definition of your tool window so that your project compiles, but the tool window does not work. I show you what phenomena escort this issue. Let’s put a semantic mistake into our tool window definition:&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:3b26d481-3fa2-45f7-9ddc-e6364cd81da3" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Types&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Types}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; QNumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Here, I changed the &lt;font face="consl"&gt;&lt;strong&gt;NumericCellStyle&lt;/strong&gt;&lt;/font&gt; static resource name to &lt;font face="cons"&gt;&lt;strong&gt;QNumericCellStyle&lt;/strong&gt;&lt;/font&gt;, which is faulty, as there is no such static resource. Despite of this change, our package will compile. When the tool window is about to show, we can meet with two kind of behavior. If the tool window was persisted before, when it is to be displayed at Visual Studio startup time, we can see the frame of the window, but its client area is hidden:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2216832E.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_282DA9FC.png" width="639" height="500" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When the tool window is not persisted, at creation time we get the following message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_6C8D9B3B.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_0A8BA930.png" width="444" height="191" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Fortunately, debugging will help to find out what the reason of this message is. Start the Experimental hive in debug mode and try to display the tool window. The exception caught helps you to discover that actually creating the window pane control fails:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2889B724.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_37DD1933.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Well, this message helps to discover the location of the failure but not its cause. Click on the View Detail link in the exception popup and you’ll be wiser:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_237753A8.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_7615BDD7.png" width="660" height="404" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This message tells that the problem is the name of the static resource we try to use.&lt;/p&gt;  &lt;p&gt;The VSCT files also are sources of similar issues. The VSCT compiler checks the syntax and does a few semantic checks, however, does not check all things that actually could be checked at compile time. When the VSCT file is merged with the Visual Studio menus, further checks are done, and faulty commands or UI elements are simply not merged into the VS menu. However, there are checks that occur only at runtime.&lt;/p&gt;  &lt;p&gt;So, when our VSCT file has some semantic errors, it could lead to unexpected issues. Let me show one of them. I modify the VSCT file so, that the refresh button of the tool window tool bar is parented directly in the &amp;lt;Menu&amp;gt; item representing the tool bar and not in the &amp;lt;Group&amp;gt; element that is the logical container for the Refresh button. The original definition is:&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:7b7f9003-683f-4d5f-8e2b-5494380bcc49" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidCSharpStatsCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdidRefreshCSharpStats&lt;/span&gt;&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;priority&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;0x0100&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Button&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Parent&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidCSharpStatsCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;RefreshToolbarGroup&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Icon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidOfficeIcon&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;msotcidRefresh&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Strings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;RefreshProcessList&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ButtonText&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Refresh Process List&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ButtonText&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Strings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;I&amp;#160; change it to:&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:6b7f308c-aec6-469e-a0a0-6dafb137cea6" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidCSharpStatsCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;cmdidRefreshCSharpStats&lt;/span&gt;&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;priority&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;0x0100&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;Button&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="color:#008000;"&gt; I&amp;#39;ve changed the parent id &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;--&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Parent&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidCSharpStatsCmdSet&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;CSharpStatsToolbar&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Icon&lt;/span&gt;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;guid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;guidOfficeIcon&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; &lt;/span&gt;&lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt;msotcidRefresh&lt;/span&gt;&amp;quot;&lt;span style="color:#0000ff;"&gt; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Strings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;RefreshProcessList&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;CommandName&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ButtonText&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;Refresh Process List&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;ButtonText&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Strings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Button&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;This is a semantic error, the VSCT compiler does not show any error, so we can run our package. However, when we want to display the tool window, we get the following message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_52ABAB72.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2C69521A.png" width="377" height="191" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When we try to display the window second time, we face with another message:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0A9D7989.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_01CD713D.png" width="458" height="191" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Just as before, we can turn to our good friend, to the debugger. Let’s start the package in debug mode and see where it breaks!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_600198AB.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_76743732.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As you see, it breaks in the &lt;font face="cons"&gt;&lt;strong&gt;ShowToolWindow&lt;/strong&gt;&lt;/font&gt; method when calling the &lt;font face="cons"&gt;&lt;strong&gt;FindToolWindow&lt;/strong&gt;&lt;/font&gt; method, so the exception is thrown in a method that is within the Managed Package Framework. This kind of exception at the point is thrown when the shell is about putting together the window frame, the window pane and the related toolbars. By my experience, generally this message means that your VSCT file has issues, like the one I put in the file above.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_25E2A5FF.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_19084FE1.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;As a summary of the presentation, I would like to summarize my main messages on this slide. I would encourage you to leverage on WPF and MEF as they are great technologies helping you writing your extensions for VS 2010.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;To be frugal or let’s say conservative with resource consumption, be lazy with loading your components and objects owned by your component. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Keep your UI always responsive and used idle loading wherever it is possible.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;In order to cope with common package mistakes, use techniques helping to recognize while your packages fail.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;Thank you for your attention!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1310" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>DevTools Ecosystem Summit: Deploying Visual Studio 2010 Extensions, Part 2</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/21/devtools-ecosystem-summit-deploying-visual-studio-2010-extensions-part-2.aspx" /><id>/blogs/divedeeper/archive/2009/10/21/devtools-ecosystem-summit-deploying-visual-studio-2010-extensions-part-2.aspx</id><published>2009-10-20T22:23:32Z</published><updated>2009-10-20T22:23:32Z</updated><content type="html">&lt;p&gt;&lt;a title="Deploying Visual Studio 2010 Extensions, Part 1" href="http://dotneteers.net/blogs/divedeeper/archive/2009/10/20/devtools-ecosystem-summit-deploying-visual-studio-2010-extensions.aspx"&gt;&amp;lt;Part1&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_523F8D02.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_29C0AAEE.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;[Quan] &lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;Istvan is now going to show you how to create an extension and how to publish it to the Visual Studio gallery.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;[Istvan] In this demo I will create a simple package with a Nice Tool Window. I have installed Visual Studio SDK on my machine, and now I create this package using a Visual Studio Package. I go to File|New|Project and select the Visual Studio Integration Package template to start a new project.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_65325A6B.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_671FA974.png" width="660" height="427" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I name my projects to &lt;font face="cons"&gt;&lt;strong&gt;NiceToolWindow&lt;/strong&gt;&lt;/font&gt; and click OK. The VSPackage template launches the Visual Studio Integration Package Wizard with the following Welcome page:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_20550957.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_6B385459.png" width="260" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In the first page I declare that I want to create a C# package.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image31_5F00_703A9208.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image31_5F00_thumb_5F00_2E53ACBA.png" width="260" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The second page collects a few information about my package used for code generation and displaying branding information.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image61_5F00_65B9BDE8.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image61_5F00_thumb_5F00_5CE9B59C.png" width="260" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I declare that I want to create only a Tool window this time:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image91_5F00_09263C81.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image91_5F00_thumb_5F00_00563435.png" width="260" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I specify the name for my tool window and set the ID to be used for the command showing up it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image12_5F00_25DFB196.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image12_5F00_thumb_5F00_75D56014.png" width="260" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the last wizard page I clear the checkboxes, because for this demo I do not want any test projects to be generated.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image15_5F00_338247D1.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image15_5F00_thumb_5F00_46C2FE70.png" width="260" height="203" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;As you see, the wizard creates the code in a few seconds. I can immediately build and run it. By pressing Ctrl+F5 a new Visual Studio instance is started. As you see from its title, it is called “Visual Studio Experimental Instance”. This runs exactly the same devenv.exe as our main instance, but uses a separate set of configuration settings. This instance works as a test bed for the package.&lt;/p&gt;  &lt;p&gt;Our nice tool can be accessed&amp;#160; by using the View|Other Windows|Nice Tool Window command. It displays the tool window, and as we click on the button it pops up a message indicating that it really works!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0886F591.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_595509F9.png" width="470" height="225" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now I close the Experimental instance and go back to the source code generated.&lt;/p&gt;  &lt;p&gt;When I ran the package, it was deployed for the Experimental Instance with VSIX. The key of the deployment is the &lt;font face="cons"&gt;&lt;strong&gt;source.extension.vsixmanifest&lt;/strong&gt;&lt;/font&gt; file as you see it here in the Solution Explorer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_20C4B904.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_47631F84.png" width="296" height="374" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This file contains all the information used to create the deployment package just as Quan mentioned. When I open it, a new designer displays the content of the manifest. This time in Beta2 this design surface does not seem very polished:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1A0189B4.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_5B4C8C4D.png" width="660" height="454" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Instead, I use the code view, as the VSIX file is actually an XML file, and you can recognize the the sections representing the information Quan talked about:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2CA65D9E.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_10B528A6.png" width="660" height="406" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The package is identified by its &lt;font face="con"&gt;&lt;strong&gt;Id&lt;/strong&gt;&lt;/font&gt; and &lt;font face="con"&gt;&lt;strong&gt;Version&lt;/strong&gt;&lt;/font&gt;, and it has a few set of display attributes. This manifest tells that the extension is supported by the Professional edition of Visual Studio. The &lt;font face="cons"&gt;&lt;strong&gt;VSPackage&lt;/strong&gt;&lt;/font&gt; element in the &lt;font face="cons"&gt;&lt;strong&gt;Content&lt;/strong&gt;&lt;/font&gt; section tells that our extension is a Visual Studio package. The &lt;font face="cons"&gt;&lt;strong&gt;|NiceToolWindow;PkgdefProjectOutput|&lt;/strong&gt;&lt;/font&gt; token provides the information the build process uses to set up the list of artifacts to be included in the deployment kit.&lt;/p&gt;  &lt;p&gt;Let’s build our package, and see what is within the .vsix file we get! Because the .vsix file is a zip archive conforming with the Open Packaging Convention, we can rename it to .zip, open it to look what’s inside:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_5012C510.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_356628F7.png" width="456" height="114" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We can see that the &lt;font face="cons"&gt;&lt;strong&gt;NiceToolWindow.dll&lt;/strong&gt;&lt;/font&gt; encapsulation our package is there and also we see a file with the name &lt;font face="cons"&gt;&lt;strong&gt;NiceToolWindow.pkgdef&lt;/strong&gt;&lt;/font&gt;. This latter one contains the registry settings required to register our package which is a COM component.&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:af28ae1a-bef6-4765-9233-d900aec2ab87" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;[$RootKey$&amp;#92;InstalledProducts&amp;#92;NiceToolWindowPackage]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;@=&amp;quot;#110&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;Package&amp;quot;=&amp;quot;{6617051f-7e5c-41b6-9f62-8221d1cfc372}&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;PID&amp;quot;=&amp;quot;1.0&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;ProductDetails&amp;quot;=&amp;quot;#112&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;LogoID&amp;quot;=&amp;quot;#400&amp;quot;&lt;/li&gt; &lt;li&gt;[$RootKey$&amp;#92;Packages&amp;#92;{6617051f-7e5c-41b6-9f62-8221d1cfc372}]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;@=&amp;quot;DiveDeeper.NiceToolWindow.NiceToolWindowPackage, NiceToolWindow, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6c8545f2ca1aeabb&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;InprocServer32&amp;quot;=&amp;quot;$WinDir$&amp;#92;SYSTEM32&amp;#92;MSCOREE.DLL&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;Class&amp;quot;=&amp;quot;DiveDeeper.NiceToolWindow.NiceToolWindowPackage&amp;quot;&lt;/li&gt; &lt;li&gt;&amp;quot;CodeBase&amp;quot;=&amp;quot;$PackageFolder$&amp;#92;NiceToolWindow.dll&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;[$RootKey$&amp;#92;Menus]&lt;/li&gt; &lt;li&gt;&amp;quot;{6617051f-7e5c-41b6-9f62-8221d1cfc372}&amp;quot;=&amp;quot;, Menus.ctmenu, 1&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;[$RootKey$&amp;#92;ToolWindows&amp;#92;{65f23b5e-328d-40f0-9963-59916b77368d}]&lt;/li&gt; &lt;li&gt;@=&amp;quot;{6617051f-7e5c-41b6-9f62-8221d1cfc372}&amp;quot;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;quot;Name&amp;quot;=&amp;quot;DiveDeeper.NiceToolWindow.MyToolWindow&amp;quot;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;In the past with VS 2008 the settings in this file were used to create the MSI installation kit, and had to be put into the install kit in order the package could be registered during setup time. There’s no need to do it anymore! The VSIX installer will extract this information form the zip archive and Visual Studio will use it at the next startup to register the package.&lt;/p&gt;  &lt;p&gt;Now, we have seen how our nice tool window’s deployment package has been created. We are going to share this component with the community through Visual Studio Gallery. We can access the gallery with the &lt;a href="http://www.visualstudiogallery.com"&gt;http://www.visualstudiogallery.com&lt;/a&gt; URL.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_25E31728.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_70F611EA.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The most important button to share our NiceToolWindow is the Upload button just right below the search text box. Before starting the sharing process, I would like to give you a very short guided tour around the gallery.&lt;/p&gt;  &lt;p&gt;You can use the departments under Categories to look for a specific type of component. For example, opening the Tools department and then selecting Coding, you get a list of components related to coding tasks.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_55710FE7.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_366AEC49.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Under categories you can filter the components by Visual Studio versions. Select Visual Studio 2010 to see which coding tools work with VS 2010:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_61CF0D43.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_1F0FC20B.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You can also filter by cost category. When you click on “Free” you’ll see only free coding components working with VS 2010.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0EB44A52.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2BD9F25C.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Clicking on a components directs you to the details page where you can immediately download and install the component.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_563D0608.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_45092865.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So, let’s go back to our original idea, and upload the NiceToolWindow package to the gallery. It contains three easy steps that start with clicking on the Upload button. In order to upload components, you must sign in. The first step is selecting the type of extension. In our case it is a tool.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_7E290F9E.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_428900DE.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The next step is to decide how we want to upload the component:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_406C0215.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_490C5AA1.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We can select from two options. We could take the first option to allow community members download it directly from the gallery. In this case the component detail page will display a “Download” button. The second option lets us specify a link to redirect members to another page where we can manage the whole download/purchase process. In this case the component detail page will display a “Get now” button.&lt;/p&gt;  &lt;p&gt;I have selected the first option, because I want to share a free component, and I also selected the &lt;font face="cons"&gt;&lt;strong&gt;NiceToolWindow.vsix&lt;/strong&gt;&lt;/font&gt; file to upload. When I click the Next button, the .vsix file is uploaded and you can specify a few more attributes to categorize your component, and also can add a rich text description to it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_74DCAE90.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_66BDBF93.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Before going on, you I to accept the contribution agreement…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_64348DD5.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_0D5C2614.png" width="660" height="136" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;and my component is ready to be published:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_048C1DC8.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_0FD53205.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At this point I can click on the “publish” link to allow gallery visitors to browse and download NiceToolWindow, as you see it is at the top of the list of recently added components.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0805CF6F.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_04A437C7.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now, I put the cap of a community member on my hat to show you how easy is to find and download the uploaded component. I open Visual Studio 2010 and start Extension manager. Because I’m looking for a “nice tool” I type “Nice” in the search box.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_300858C1.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_54B97038.png" width="660" height="427" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The simple tool we have just uploaded is on the list! When I click on download, install it, it goes into my Installed Extensions tab.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0427DF05.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2C2A6857.png" width="660" height="427" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After restarting Visual Studio, this “great” tool can be immediately started. If I do not like it, I can click on the Uninstall button to remove it.&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;I hope you’ve liked it, and I whet your appetite to share extensions!&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2415FC93.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_08FD2D85.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;[Quan] &lt;span&gt;&lt;font size="3" face="Calibri"&gt;Now that you’ve seen how easy it is to build and deploy an extension, we want you to start building and sharing extensions with the whole world! &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;In case you ship something and need to make changes later on, we provide a simple update model that removes the existing extension and lays down a new one.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;All you need to do is specify the same VSIX ID – the unique identifier and a newer version.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Then upload it to the gallery and customers who have the old version can download your update.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;span&gt;   &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_6012187B.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_6EF94795.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;So, hopefully we’ve sold you on how cool xcopy deployment is.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;It’s so simple, a caveman can do it.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;However, xcopy does have limitations which I do want to call out.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;We don’t write to the registry outside of the VS hive.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;To write to the registry, you can use a pkgdef file.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;However, that’s limited to the VS Hive.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Writing keys for anything else, including file associations into HK Classes Root is not supported.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Other things not supported are start menu and desktop shortcuts, framework functionality such as creating Native Images or adding files to the Global Assembly Cache.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Lastly, this is xcopy.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Install is copy or unzip.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Uninstall is delete the folder.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;We don’t support custom actions.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;If you’re installing a database extension and need to configure your back end SQL Server database, use an MSI.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0995BDE2.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_6DA488E9.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;If you extension is completely inside the VS world, VSIX works well and is the recommended extension deployment technology for VS 2010.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;If you need to install or configure things outside of VS, we still support MSI installs.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;The in product experience will show the MSIs that are uploaded to the VS Gallery however acquiring them will take the user to the landing page in IE where they can download and install the MSI.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1F963DC9.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_7F3B5B7E.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;To make sure your extension appears in the list of installed extensions in the Extension Manager, make sure your MSI installs a VSIX manifest and sets the &lt;font face="cons"&gt;&lt;strong&gt;InstalledByMSI&lt;/strong&gt;&lt;/font&gt; element to true.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;The payload will also need to be installed to the &lt;font face="cons"&gt;&lt;strong&gt;VSInstallDir\Common7\IDE\Extensions&lt;/strong&gt;&lt;/font&gt; directory.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;If you have registry keys under the VS Hive or packages that need to be registered, use a pkgdef file.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Also, there shouldn’t be a need for you to call &lt;font face="cons"&gt;&lt;strong&gt;devenv.exe /setup&lt;/strong&gt;&lt;/font&gt; for VS 2010.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;The end user will be able to see your extension installed however, they will still need to go to Windows Add/Remove programs to remove it.&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_5245F8A3.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_50952CCF.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;We threw a lot at you today.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;So, now that you’ve got all this knowledge, go download and install VS 2010 and the SDK, then start building extensions and sharing them on the VS gallery!&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;And with that final note, we’re done with our deploying VS extensions talk.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;/span&gt;  &lt;h6&gt;&lt;span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Thank you for your time.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;I hope we’ve got you excited about the extension manager and how easy it is to share your extensions!&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h6&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1292" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author><category term="VSX" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VSX/default.aspx" /><category term="VS 2010" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VS+2010/default.aspx" /></entry><entry><title>DevTools Ecosystem Summit: Deploying Visual Studio 2010 Extensions, Part 1</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/20/devtools-ecosystem-summit-deploying-visual-studio-2010-extensions.aspx" /><id>/blogs/divedeeper/archive/2009/10/20/devtools-ecosystem-summit-deploying-visual-studio-2010-extensions.aspx</id><published>2009-10-20T18:28:29Z</published><updated>2009-10-20T18:28:29Z</updated><content type="html">&lt;p&gt;I had the opportunity to present at the DevTools Ecocsystem Summit held in Redmond between October 19 and 23. I had two presentations, the first with the title “Best Practices for Extending the IDE with a Focus on Performance”, and the second held in cooperation with Quan To with the title of “Deploying Visual Studio 2010 Extensions”. &lt;/p&gt;  &lt;p&gt;After the presentations I decided to blog the presentations in a transcript-like way including demos with source code and screenshots.&lt;/p&gt;  &lt;p&gt;This post is the first part of the “Extension Deployment” presentation held together with Quan.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2B8E1075.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_77797121.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;[Quan] Good Aftenoon!&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Welcome to the Deploying Visual Studio 2010 Extensions session!&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;I’m Quan To, a program manager on the Visual Studio Platform team.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;My partner for this talk is Istvan Novak, one of our VSX MVPs and an expert in extending Visual Studio.&lt;/span&gt;&lt;/p&gt; &lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;   &lt;p&gt;&lt;span&gt;I’ve spent 3 years as the Visual Studio Deployment Program Manager prior to joining the platform team and even though I know MSI pretty well, it’s still hard to deploy a VS extension!&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0EC47593.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_53FCCCBC.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span&gt;There’s already a lot to know when building an extension.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Why do you need to learn even more stuff and all the nuisances about deploying an extension?&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Everyone knows creating an MSI is hard.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;You need to learn MSI, buy install shield or spend some time learning Wix, then search for which registry keys you need to write for VS to find your extension, and hope everything works when you build your setup.&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0443A173.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_68BE9F6F.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span&gt;Setup is painful.&lt;span style="mso-spacerun:yes;"&gt;&amp;#160; &lt;/span&gt;Instead of having these experiences when deploying your extensions…&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_66356DB1.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_3867A4EC.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;span&gt;We want you to make you happy, happy, happy!&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0cm 0cm 10pt;" class="MsoNormal"&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_783FB223.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_4F549D1A.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;I’m going to hand things over to Istvan who is going to show you our cool new deployment and acquisition experience we built into VS 2010.&lt;/span&gt;&lt;/p&gt;   &lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;     &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;[Istvan] &lt;span&gt;Good Afternoon! It is great to be here on this Summit and see that so many attendees cannot be seduced by the other track!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/span&gt;    &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;In this demo I will show you one of my favorite features in the new Visual Studio release, namely Extension Manager and the related user experience. I can easily access the Extension manager from the Tools menu or from the toolbar by clicking on this Tetris-like button.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_4DA3D146.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_765F368F.png" width="660" height="427" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;When this window opens up you immediately see the extensions already installed that can be templates or tools. This time I have only the Power Commands tool installed. There are two nice tabs in the left pane. &lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;By clicking on the Online Gallery tab you start browsing the components available in Visual Studio Gallery. The list is created in a few seconds and when you select an item in it, the related description is displayed in the right pane.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0FE6C3BD.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_3FC1657E.png" width="660" height="427" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;Well, I’m searching for a tool that could help me in navigating through my source code files. Let’s try to search for the word “source” and look if I can find a tool like that…&lt;/p&gt;    &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_166A1D80.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_5417053C.png" width="660" height="427" /&gt;&lt;/a&gt; &lt;/p&gt;    &lt;p&gt;There are many tools having the word “source” somewhere in their description… Here is one named Source Outliner! It’s description suggests that it may the tool I’m looking for! I click on the Download button and Extension manager immediately starts downloading the extension.&lt;/p&gt; &lt;/span&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_26B56F6C.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2BB7AD1B.png" width="461" height="383" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I Click on install signing I accept the licence agreement. The tool installs in a second, and appears in the Installed Extensions tab immediately.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_395A4356.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_77072B12.png" width="660" height="427" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;As you can see from the message at the bottom of the dialog, installing a tool requires a Visual Studio restart. I do not want to go into details why this restart it is necessary, and please believe me, it is not because the VS team is lazy and simply did not want to implement some features to avoid the restart. This has more deep architecture reasons. &lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;Restarting VS is not painful. The IDE returns back to the state where you left it before, and also loads your recent solution. As you see it is quite quick.&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;Now, I can use the View|Other Windows|Source Outliner Power Toy command to display this tool. I “dogfood” it by opening its source and selecting the &lt;font face="cons"&gt;&lt;strong&gt;CodeOutlineFileManager.cs&lt;/strong&gt;&lt;/font&gt; file for further examination. When I click a member in the tool window, the corresponding code is marked in the source file window.&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_22D77F02.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_127C0749.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I like this tool! If I did not like it, I could uninstall it from Extension Manager simply selecting this tool from the Installed Extensions tab, and clicking on Uninstall. Just as when I installed the tool, I have to restart Visual Studio to finish removing it.&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;I hope, now you can understand why it is one my favorite features. &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="line-height:115%;font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:11pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;/span&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1F7A9C3D.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_24E90CE1.png" width="500" height="380" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;[Quan] As Istvan mentioned, the backend to the Extension Manager is the Visual Studio Gallery. Some of you may know that we launched the Visual Studio Gallery back in VS 2008. In less than 2 years, we have over 1200 extensions on the gallery! As a side note, we surpassed our competition a month ago J&lt;/p&gt;  &lt;p&gt;Some other notable changes we made to the gallery include moving to be a part of MSDN, the UI and navigation, we’ve improved the ratings and reviews, added things like notifications and statistics, and web services for the extension manager to talk to. The other big thing we now provide is a place to host your extension. Instead of just reference links, you now have the option to post your extension bits on the gallery.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2338410D.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2F59BB34.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I’m going to walk you through the Extension Manager architecture to show you the flow of an extension through the system.&lt;/p&gt;  &lt;p&gt;We start with Visual Studio and the new Extension Manager service. This service will talk to the online gallery and handle downloading, installing, uninstalling, enabling, disabling, and querying of extensions.&lt;/p&gt;  &lt;p&gt;Within Visual Studio, there are extension manager clients that talk to the Extension Manager Service. This includes the Extension Manager UI, the New Project Dialog, and even the Start Page talks to the extension manager.&lt;/p&gt;  &lt;p&gt;The clients ask the extension manager for a list of extensions that can be downloaded and installed. The Extension manager queries the gallery and returns a list of extensions. The client then tells the extension manager which extension to install and the file gets downloaded onto the user’s machine. The extension then gets installed to a per user or per machine location.&lt;/p&gt;  &lt;p&gt;The unit of deployment here is this purple box which we call a V-SIX or V.S.I.X.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_44A6F671.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_37606D5E.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The VSIX file is a renamed zip file. It’s our mechanism for packaging up an xcopy deployable extension. The VSIX contains two main parts, your payload and the manifest.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_478C3557.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_7EF24685.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The VSIX manifest file contains three distinct parts. The first is the metadata about your extension including the name, company, version, license and icons. The second part allows you to declare dependencies on other VSIX files. If those aren’t installed on the machine, you won’t be able to install your VSIX. We also have a notion of nested VSIXes which means you can carry your dependency in your payload and have that installed first.&lt;/p&gt;  &lt;p&gt;The third part is the content section which specifies the key content parts of your extension.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_6445AA6C.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_49990E53.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;For VS 2010, we support several types of content. These include VS Packages, MEF Components, Project and item Templates, and Toolbox Controls. We also support custom types so if you build your own extensibility points, your own customers can extend your extension. Our custom start pages inside VS is an example of a custom type.&lt;/p&gt;  &lt;p&gt;Things that didn’t make it as a supported VSIX type in Dev 10 are Addins and Snippets. We are hoping to add those in a future release of VS.&lt;/p&gt;  &lt;p&gt;&lt;a title="Deploying Visual Studio 2010 Extensions, Part 2" href="http://dotneteers.net/blogs/divedeeper/archive/2009/10/21/devtools-ecosystem-summit-deploying-visual-studio-2010-extensions-part-2.aspx"&gt;Part 2&amp;gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1291" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>DevTools Ecosystem Summit: Best Practices for Extending the IDE with a Focus on Performance, Part 2</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/20/DevToolEcosystemSummitVSX202Part2.aspx" /><id>/blogs/divedeeper/archive/2009/10/20/DevToolEcosystemSummitVSX202Part2.aspx</id><published>2009-10-20T12:25:11Z</published><updated>2009-10-20T12:25:11Z</updated><content type="html">&lt;p&gt;&lt;a title="Best Practices for Extending the IDE with a Focus on Performance, Part 1" href="http://dotneteers.net/blogs/divedeeper/archive/2009/10/20/DevTools_2D00_Ecosystem_2D00_Summit_2D00_VSX202_2D00_Part1.aspx"&gt;&amp;lt;Part 1&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_70E4044D.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_4C8EF9FE.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;After treating and demonstrating why is it beneficial to turn to WPF, let’s see how extensions can target better performance. I’d be able to talk about performance topics so much that I could take over all the session slots left for today or even for tomorrow… Instead of treating each of them, I collected a bunch of tips that gives you ideas what you can do with performance issues or how you can avoid them.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;The key of providing a great performance can be described simply: Consume only the resources you really, really, really need. &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;If possible, release unused resources and claim them when you need them again. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;This approach starts with loading your package only when that is required and not before. By default the VS shell loads packages on-demand when the first command, UI, service or other package owned objects are about to be used. However, you can change this behavior by either loading explicitly your package with the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;IVsShell.LoadPackage&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; method, or adding the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ProvideAutoLoad&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; attribute to your packages. This attribute provides that your package is automatically loaded when the Shell enters in a certain context, for example a solution is loaded, the build process started, and so on.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;I suggest totally avoiding the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;LoadPackage&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; approach. &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;You must use the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ProvideAutoLoad&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; attribute also wisely. If you use the so-called &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;NoSolution&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; context it causes the shell automatically load your package at VS startup time. This context is heavily overloaded and startup time is everyone’s concern. However, this is also broken in a few situations: for example when you run devenv.exe from a command line with a file or solution, your package does not get loaded. Be more selective with using this attribute.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;If you are implementing tool windows, you can set the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ProvideToolWindowVisibility&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; attribute to display the tool window when the shell enters in a specific context. This time your package is loaded. When you create a tool window, the instance behind that is never destructed, even if you close the tool window. You can catch the event when tool windows are about to be hidden or shown and this can be used to release and then reallocate resources.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;If your extension takes time to make some kind of processing be sure to write it so that the UI remain responsive. You can use some kind of background threading for provide this responsiveness or even you can leverage on using the CPU and other resources while Visual Studio is idle.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_180E27B6.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_7C8925B2.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;I think the concepts I have mentioned tell more if we try them in the practice. I have created a &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;VSPackage&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; to demonstrate how to use &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;AutoProvideLoad&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; attribute, what idle processing means and I also show how we can release and reallocate resources held by tool windows.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;My package implements a tool window that parses all C# files in the active project and displays some useful statistics about them, for example, how many methods and statements they use. This package is far away from being functionally completed, but gives me good opportunity to demonstrate performance things. &lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;I also use this sample to show a few concepts and how it evolved to reach this state.&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;First I build this package and show how it will look like after applying all enhancements. When I open a solution, the C# Statistics tool window automatically appears and starts parsing C# files:&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1E254E84.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_49896F7E.png" width="660" height="283" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;I used the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ProvideToolWindowVisibility&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; attribute and set it to the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;SolutionExist&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; context to show the tool window automatically when a solution is opened:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&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:710984ad-f26d-4e0d-9802-845e4ede072b" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;//[ProvideAutoLoad(GuidList.UICONTEXT_SolutionExists)]&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;[&lt;span style="color:#2b91af;"&gt;ProvideToolWindowVisibility&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;CSharpStatsToolWindow&lt;/span&gt;),&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;GuidList&lt;/span&gt;.UICONTEXT_SolutionExists)]&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;This attribute takes two parameters. The first represents the type of the tool window we set the visibility options for, the second is the GUID of the UI context to bind the visibility of the window to. You can use this attribute for the same window type to set multiple UI contexts.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;Should I used the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ProvideAutoLoad&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; attribute, the owner package would be loaded but the tool window would not be displayed.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;Let’s debug the package and show how it works. I put a breakpoint into the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;Initialize&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; method that is to be executed right after the package has been load by the shell, and start debugging it.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;You see that Visual Studio has finished its startup, but the breakpoint have not yet reached. Now I open the C# solution in the Experimental Instance, and as you see, now the breakpoint has been reached signing that our package has been loaded.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_6D813CBA.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_72837A69.png" width="660" height="301" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;Now, let’s change the context to &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;FullScreen&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;/font&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:7eafae26-4c92-4841-8fcf-3018af7b7470" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;[&lt;span style="color:#2b91af;"&gt;ProvideToolWindowVisibility&lt;/span&gt;(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;CSharpStatsToolWindow&lt;/span&gt;),&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;GuidList&lt;/span&gt;.UICONTEXT_FullScreenMode)]&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Running the application this time will show the tool window when we use the View|Full screen. As the full screen mode is left, the tool window is hidden again. This is exactly what &lt;font face="cons"&gt;&lt;strong&gt;ProvideToolWindowVisibility&lt;/strong&gt;&lt;/font&gt; does. When entering into the context, the tool window is (created and) displayed, when leaving the context, the window is hidden.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;span&gt;   &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;Let’s set it back the attribute’s value to &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;SolutionExists&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt;. Now I show you a few internals of the package and then demonstrate a few steps I have reached during application development. The implementation follows the Model-View-Controller pattern.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;The C# parsing related functions are provided by the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ICSharpStats&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; service (Model interface), here you can see, how simple the service interface is:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt; &lt;/span&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:797a5a3c-cc26-4bf7-bcdf-49e54302a415" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;[&lt;span style="color:#2b91af;"&gt;Guid&lt;/span&gt;(&lt;span style="color:#a31515;"&gt;&amp;quot;99C37858-E1A7-468B-AC62-FBE842E25387&amp;quot;&lt;/span&gt;)]&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;interface&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ICSharpStats&lt;/span&gt;&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Collects all .cs files from the active project&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; GetCSharpFiles();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Parses the specified file and collects C# info&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;CSharpFileInfo&lt;/span&gt; ProcessFile(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; fileName);&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;This service is implemented by the &lt;font face="cons"&gt;&lt;strong&gt;CSharpService&lt;/strong&gt;&lt;/font&gt; class that plays the role of Model. It uses my own C# parser to collect information from C# files.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;The UI of the application is provided by a WPF user control that really implements the View role in the MVC pattern, and does not handle any controller functions. The XAML definition of the UI is simple:&lt;/font&gt;&lt;/span&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:b560c3cc-9d24-40d0-9828-8f2108afd38a" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;UserControl&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Class&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;DiveDeeper.CSharpStats.CSharpStatsControl&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;mc&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; xmlns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;d&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; mc&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Ignorable&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;d&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; d&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;DesignHeight&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;300&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; d&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;DesignWidth&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;300&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MyToolWindow&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Background&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DynamicResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; VsBrush&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;.ToolWindowBackground}&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Key&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;ColumnHeaderStyle&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; TargetType&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;DataGridColumnHeader&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Setter&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Property&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;FontWeight&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;SemiBold&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Key&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;NumericCellStyle&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Setter&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Property&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;TextBlock.TextAlignment&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Right&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DockPanel&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Margin&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;4&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; DockPanel.Dock&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Bottom&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Orientation&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Horizontal&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Text&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Remaining items: &amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; x&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;:&lt;/span&gt;&lt;span style="color:#ff0000;"&gt;Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;RemainingLabel&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;0&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;TextBlock&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt; &lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StackPanel&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGrid&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;FileInfoGrid&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; AutoGenerateColumns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;False&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; GridLinesVisibility&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;All&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; HeadersVisibility&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;All&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; VerticalContentAlignment&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; VerticalScrollBarVisibility&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ColumnHeaderStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ColumnHeaderStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; BorderBrush&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;CadetBlue&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; HorizontalGridLinesBrush&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Gainsboro&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; VerticalGridLinesBrush&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Gainsboro&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; AlternatingRowBackground&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Azure&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; AreRowDetailsFrozen&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;False&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; FontSize&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;14&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;File&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; FileName}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; FontWeight&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;SemiBold&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Foreground&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Maroon&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Namespaces&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Namespaces}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Types&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Types}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Nested Types&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NestedTypes}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Members&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Members}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Methods&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Methods}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Statements&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Statements}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;/&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Path&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; FilePath}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGrid.Columns&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGrid&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DockPanel&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;UserControl&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;font size="3" face="Calibri"&gt;&lt;/font&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;The code behind of the UI illustrates the this user control is really used as a view, free from Controller functionality:&lt;/font&gt;&lt;/span&gt;&lt;/font&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:08997c43-18a0-4e82-81f2-1e9492db4c0e" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CSharpStatsControl&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;UserControl&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Initializes the control&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; CSharpStatsControl()&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;InitializeComponent();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Sets the source of the data grid.&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; SetItemsSource(&lt;span style="color:#2b91af;"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;CSharpFileInfo&lt;/span&gt;&amp;gt; source)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FileInfoGrid.ItemsSource = source;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Sets the value of remaining items&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; SetRemainingCount(&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; remainingCount)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;RemainingLabel.Text = remainingCount.ToString();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;The lion’s share of the work is done by the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;CSharpStatsToolWindow&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; class in the role of Controller.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;I have built in a few flags into this class to help me show earlier states of the application. So let me show you what the first version of my package was from the user responsiveness point of view.&lt;/font&gt;&lt;/span&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:a3846978-0cf7-4b60-891e-45ad5b8c7763" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// --- Constants and fields used for demonstration&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Slowing = &lt;span style="color:#a52a2a;"&gt;1&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; SleepTime = &lt;span style="color:#a52a2a;"&gt;20&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; _IdleCounter;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; UseIdleProcessing = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; UseResourceSavings = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; UseAutoRefresh = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;[Set the &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;UseIdleProcessing&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; flag to &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;false&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; and run the package. Show that opening a project stops UI responding about for 5 seconds.]&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;You see, it is not a “polite” behavior. The root issue is that parsing more than 400 C# files takes time. If it happens on the main UI thread, then it blocks any other activities. How this could be improved? Well we can use idle processing, make the work done while Visual Studio is idle.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;I have made the following architectural changes in the controller:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Instead of processing the C# files, I put them into a queue. When the Shell is idle, it takes one file from the queue, parses it and then adds it to the to the collection used as an item source for the grid. &lt;/li&gt;    &lt;li&gt;The item source of the grid is implemented as an &lt;font face="cons"&gt;&lt;strong&gt;ObservableCollection&amp;lt;&amp;gt;&lt;/strong&gt;&lt;/font&gt;. When a file is processed and added to this collection, the UI is refreshed without any further coding.       &lt;p&gt;&lt;/p&gt;   &lt;/li&gt; &lt;/ul&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:50021a74-9c92-41d0-8f69-5b976310b420" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// --- List containing the processed C# items &lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ObservableCollection&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;CSharpFileInfo&lt;/span&gt;&amp;gt; _FileInfoCollection;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#008000;"&gt;// --- Queue holding items for idle processing&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Queue&lt;/span&gt;&amp;lt;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;&amp;gt; _FilesToProcess;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;Preparing our tool window for idle processing requires registering it with &lt;font face="cons"&gt;&lt;strong&gt;OleComponentManager&lt;/strong&gt;&lt;/font&gt; in the &lt;font face="cons"&gt;&lt;strong&gt;OnCreated&lt;/strong&gt;&lt;/font&gt; method:&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:a8d5bfa7-d2a3-425c-a95f-3fbf09002ffc" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// --- Set up Idle processing&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; oleComponentManager = &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.GetService(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;SOleComponentManager&lt;/span&gt;))&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IOleComponentManager&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (oleComponentManager != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt; pwdId;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;OLECRINFO&lt;/span&gt;[] crinfo = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;OLECRINFO&lt;/span&gt;[&lt;span style="color:#a52a2a;"&gt;1&lt;/span&gt;];&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;crinfo[&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;].cbSize = (&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;Marshal&lt;/span&gt;.SizeOf(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;OLECRINFO&lt;/span&gt;));&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;crinfo[&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;].grfcrf = (&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;_OLECRF&lt;/span&gt;.olecrfNeedIdleTime |&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;(&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;_OLECRF&lt;/span&gt;.olecrfNeedPeriodicIdleTime;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;crinfo[&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;].grfcadvf = (&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;_OLECADVF&lt;/span&gt;.olecadvfModal |&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;(&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;_OLECADVF&lt;/span&gt;.olecadvfRedrawOff |&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;(&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt;)&lt;span style="color:#2b91af;"&gt;_OLECADVF&lt;/span&gt;.olecadvfWarningsOff;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;crinfo[&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;].uIdleTimeInterval = &lt;span style="color:#a52a2a;"&gt;1000&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;oleComponentManager.FRegisterComponent(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;, crinfo, &lt;span style="color:#0000ff;"&gt;out&lt;/span&gt; pwdId);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;The tool window also should implement the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;IOleComponent&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; interface with its 11 members.&lt;/span&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:23c2ab53-f0dd-4d23-aabc-f16f64ca51bc" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CSharpStatsToolWindow&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;ToolWindowPane&lt;/span&gt;, &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;IVsWindowFrameNotify3&lt;/span&gt;, &lt;span style="color:#2b91af;"&gt;IOleComponent&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;The most important is the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;FDoIdle&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; method that runs where the shell is idle:&lt;/span&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:1d6090f0-a1d4-4b85-ad9d-adadb0645121" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IOleComponent&lt;/span&gt;.FDoIdle(&lt;span style="color:#0000ff;"&gt;uint&lt;/span&gt; grfidlef)&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;ProcessOnIdle();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;VSConstants&lt;/span&gt;.S_OK;&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;The work is done by the &lt;font face="cons"&gt;&lt;strong&gt;ProcessOnIdle&lt;/strong&gt;&lt;/font&gt; method that contains “artificial slowing” to support demonstration:&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:02a31ab3-d40b-43f6-9c41-36778b7462ba" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; ProcessOnIdle()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (_IdleCounter++ % Slowing != &lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; nextFile;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;lock&lt;/span&gt; (_FilesToProcess)&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (_FilesToProcess.Count == &lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;nextFile = _FilesToProcess.Dequeue();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;_FileInfoCollection.Add(_CSharpService.ProcessFile(nextFile));&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="3"&gt;&lt;span&gt;&lt;font face="Calibri"&gt;Now I show you that this code provides UI responsiveness. For the sake of this demo, I slow idle processing down so that only every sixth &lt;/font&gt;&lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;FDoIddle&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;font face="Calibri"&gt; call will do effective work.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;[Set the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;Slowing&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; value to 6 and set the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;UseIdleProcessing&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; flag to &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;true&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;. Open the C# project used to parse before. Show that while the files are parsed, the UI stays responsible, refreshes the list of files parsed. Demonstrate that files can be opened and edited and also the C# statistics tool window can be closed and reopened.]&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;During this demo you can follow how more and more C# files are parsed during idle processing:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_1C0BDB5F.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_0424F439.png" width="660" height="283" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_5E4ECDD5.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_3C82F544.png" width="660" height="283" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Some remarks: when you close the tool window, idle processing goes on in the background, now it is intentional just because of demo reasons. However, in a real production environment you should implement idle processing so that hiding your tool window suspends the idle processing, showing the tool window enables it again.&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;Now, let me show how to release and reclaim resources when the tool window is hidden and shown again. I have extended the class providing information about a C# file so that it will allocate one megabyte of memory to put some fake information into it. I will show you how much memory it takes. Here is the code to allocate (and release) memory:&lt;/span&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:7a1de541-f68e-4dfa-83db-6ecc97107a76" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;CSharpFileInfo&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Members used for demonstration purposes&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; MaxLength = &lt;span style="color:#a52a2a;"&gt;60&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;const&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; BufferSize = &lt;span style="color:#a52a2a;"&gt;1000000&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;byte&lt;/span&gt;[] _WasteMyMemory;&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Initializes an instance according to the specified file name.&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; CSharpFileInfo(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; fileName)&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FullName = fileName;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FileName = &lt;span style="color:#2b91af;"&gt;Path&lt;/span&gt;.GetFileName(fileName);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;FilePath = &lt;span style="color:#2b91af;"&gt;Path&lt;/span&gt;.GetDirectoryName(fileName);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;AllocateResources();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Public properties for retrieving C# information&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; FileName { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; FilePath { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; FullName { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Namespaces { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Types { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; NestedTypes { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Members { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Methods { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; Statements { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;#region&lt;/span&gt; Resource allocation methods&lt;/li&gt; &lt;li&gt;&amp;nbsp;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Allocates fake resources for the class&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; AllocateResources()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (_WasteMyMemory != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;) &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;try&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_WasteMyMemory = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;byte&lt;/span&gt;[BufferSize];&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; reader = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;BinaryReader&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;File&lt;/span&gt;.OpenRead(FileName));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; bytesRead = reader.ReadBytes(BufferSize);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;bytesRead.CopyTo(_WasteMyMemory, &lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;catch&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;SystemException&lt;/span&gt;)&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- This exception is intentionaly caught&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Releases fake resources&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; ReleaseResources()&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;_WasteMyMemory = &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;nbsp;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;#endregion&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;[Set &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;Slowing&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; to 2, the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;UseResourceSavings&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; flag to &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;false&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;, and run the package. Display the Process Info window. Open the C# project and refresh the C# statistics window. Show that parsing the files in the project consumed something like 450 Mbytes of memory]&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;Before parsing started:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_3EE36F55.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2EC3B92A.png" width="598" height="238" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After parsing finished:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_4B7D2E3F.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2225E641.png" width="598" height="238" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;When the user explicitly closes the tool window the memory is not reclaimed. Closing the window is an explicit sign that the user does not intend to deal with the C# Statistics anymore, so why not to release the memory held by this window? I’ve implemented this scenario.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;First, I prepared the tool window to catch frame events including hiding and showing the frame. To catch these events we must subscribe to them by passing an &lt;font face="cons"&gt;&lt;strong&gt;IVsWindowFrameNotify3&lt;/strong&gt;&lt;/font&gt; instance -- in this case this interface is implemented by the tool window itself. The interface implements 5 methods, the one we are interested in is &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;OnShow:&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&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:edc9d8bd-fd25-423d-a393-ced3115613cd" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Responds to the event when the tool window is hidden or shown.&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; OnShow(&lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; fShow)&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (UseResourceSavings)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (fShow == &lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Tool window is about to hide&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; item &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; _FileInfoCollection)&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;item.ReleaseResources();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#2b91af;"&gt;GC&lt;/span&gt;.Collect();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// --- Tool window is about to show&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; item &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; _FileInfoCollection)&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;item.AllocateResources();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;VSConstants&lt;/span&gt;.S_OK;&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;As you see the code above, when the window is about to hide, we release all allocated resources. In contrast when the window is to be shown again, we reclaim the resources again.&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Now, let’s see the results in practice:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;[Set the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;UseResourceSavings&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; flag to &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;true&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;, the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;Slowing&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt; value to 1. Run the package, and open the Process Info Tool window. Load and analyze the C# project. Show the size of memory consumed after analysis, then close the tool window. Show the memory reservation again.]&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;This is what you can see before closing the tool window:&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_6A8008F1.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_210DB436.png" width="598" height="238" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When you close the tool window, you can see, resources have been released:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0972B46B.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_067D4FB8.png" width="598" height="238" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;When the tool window is displayed again the resources are reclaimed:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_11C663F5.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_732C734B.png" width="598" height="238" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;I hope you could see, with a few good techniques you can make your extensions’ UI more responsive and frugal with resources.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;mso-bidi-font-size:11.0pt;"&gt;&lt;a title="Extending the IDE with a Focus on Performance, Part 3" href="http://dotneteers.net/blogs/divedeeper/archive/2009/10/22/devtools-ecosystem-summit-best-practices-for-extending-the-ide-with-a-focus-on-performance-part-3.aspx"&gt;Part 3&amp;gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1288" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>DevTools Ecosystem Summit: Best Practices for Extending the IDE with a Focus on Performance, Part 1</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/20/devtools-ecosystem-summit-best-practices-for-extending-the-ide-with-a-focus-on-performance-part-1.aspx" /><id>/blogs/divedeeper/archive/2009/10/20/devtools-ecosystem-summit-best-practices-for-extending-the-ide-with-a-focus-on-performance-part-1.aspx</id><published>2009-10-20T11:32:00Z</published><updated>2009-10-20T11:32:00Z</updated><content type="html">&lt;p&gt;I had the opportunity to present at the DevTools Ecocsystem Summit held in Redmond between October 19 and 23. I had two presentations, the first with the title “Best Practices for Extending the IDE with a Focus on Performance”, and the second held in cooperation with Quan To about VS 2010 extension deployment. After the presentations I decided to blog the presentations in a transcript-like way including demos with source code and screenshots.&lt;/p&gt;  &lt;p&gt;This post is the first part of my “Performance Focus” presentation.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_7887CB1C.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_5D02C919.png" width="500" height="380" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Good Afternoon! It is great to be here at the DevTools Ecosystem Summit! Welcome to this session, just right after the lunch. I hope you’ve drunk enough coffee… &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;I’m Istvan Novak, a C# MVP and a VSX Insider from Hungary. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;I’ve spent a few years with deep diving into VSPackage development, and I would not say it is very easy, mainly because of the lack of documentation and lack of guidance.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_3A5E8A9E.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_6AA55F54.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;It the title of the session I used the expression „Focus on Performance”. Saying this I understand three things that are my main objectives with this session:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;First, I’d like to tell you a few interesting technologies and techniques to make you a more efficient Visual Studio Extensibility developer.&lt;/font&gt;&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Second, I’d like to show you a few tricks that allow your extensions have a great performance and avoid bottleneck issues.&lt;/font&gt;&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Third, I want to show you a few great potentials in Visual Studio 2010 that makes developing extensions not a challenge but rather fun.&lt;/font&gt;&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;In this session I will use only a few slides and show you a bunch of demos to let you feel what I really mean when saying technologies, techniques and tricks.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_56D2144C.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_1C0A6B76.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;As you know and probably have heard quite often, the VS 2010 UI is based on the WPF technology. While VS 2010 still fully supports Windows Forms UI, I suggest you learning WPF and designing your extensions with WPF in mind.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;If you have ever used macros or created VS Add-Ins, it is time to get familiar with the Visual Studio 2010 SDK that provides you two more extensibility options:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;To possess the full power of extensibility, create Visual Studio Packages with the Managed Package Framework. With packages you can create powerful extension for VS just like if those were shipped with the product.&lt;/font&gt;&lt;/span&gt; &lt;/li&gt;    &lt;li&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;The Visual Studio SDK also opens you a new way of extending the Visual Studio editor. While in the past doing it was very painful and a hard job, with the new editor extensibility model it becomes fun. During this session, in the other room the VSX 103 session is about creating editor extensions. I suggest you downloading the session video and watching it.&lt;/font&gt;&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Due to the COM roots of VS creating installation kits and managing deployment had many small annoying details. With VS 2010 VSPackage deployment has been significantly simplified. Visit VSX 102 in the next session slot to pick up more details on this topic.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin:3pt 0cm;" class="BodyText-Normal"&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Well, an important key to become an efficient developer: the ability to avoid the pitfalls our way is often paved with. During the session I will enumerate the most common pitfalls I’ve used to meet and help you avoiding them.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;The new .NET Framework 4.0 introduces a new technology called Managed Extensibility Framework. The role of MEF is to help the shift from statically compiled applications into the dynamically composed ones. The full VS 2010 Editor Extensibility model is built on MEF, and you can also leverage on MEF’s great features. If we’ll have enough time at the end of this session I will demo you VSPackage leveraging on MEF.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Those who use the Visual Studio Automation model heavily know how painful it is to using it from C# related to macros or to dynamic languages. C# 4.0 will support extremely useful new language features that ultimately allow using COM object models in C# just like in other scripting or dynamic languages. These include the new dynamic type, optional and named parameters. In this talk I do not dive deeper in to this topics, but I’d encourage you to check what is new is C# 4.0.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin:3pt 0cm;" class="BodyText-Normal"&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_770230B7.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2CB77612.png" width="500" height="380" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;If you asked me what I really like in the VS 2010 release I would answer the way how the Visual Studio changes to leverage on more and more managed code. While the majority of VS 2008 user interface is unmanaged, VS 2010 UI is built on the WPF technology which is managed. The new code editor changed its UI to WPF and at the same time also the codebase went to managed code.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;The WPF rendering surface is actually a DirectX surface. The performance benefits for complex user interfaces are huge. Large images can be blended and scaled in hardware and the entire scene is double-buffered to allow rich, fluid animations. So these are not HWNDs we’re dealing with – although all WPF applications will have at least one real HWND on the desktop, the contents of that HWND are managed entirely by the WPF compositing and rendering engines.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;“Retained mode” is the term used to describe a graphics system where you don’t need to get involved in the painting of your window. Contrast this to HWND-based painting where you have to handle messages such as WM_PAINT and WM_ERASEBACKGND in order to get pixels to light up on the screen. Because each HWND is responsible for painting its own contents, if an application hangs or is slow to respond, this can lead to repaint problems on the desktop – holes in the display. In a retained mode system, such as WPF, you cause the scene to be rendered by adding or updating visual objects in the scene. When the visual object tree changes, then WPF will re-render the window for you.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;The kinds of objects in the tree might be simple things such as rectangles or circles. They might be controls such as buttons, checkboxes or toolbars, or they might be advanced visual elements such as a video stream or a 3d model.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;Data binding is simply the creation of a reference from one piece of data (a datum) to another. Typically the binding creates a connection between the UI and the application’s business logic. When the source of the binding changes, the target also updates. The “binding” is described using a “binding expression”. A binding expression may be a simple path – for example, “bind the visibility of this button to the value of this boolean property” – or it may describe complex connection between, say the results of a database query and a grid control displaying the results.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;Styling allows you to override the default visualization and behavior of any WPF control. Want your buttons to glow and spin when you click them? Styling allows you to specify that behavior once and apply it to all buttons in the visual tree. Templating allows you to specify the visual appearance for all elements in a collection, for example a list box. This is a very powerful mechanism which allows us to apply a visual theme (or a “skin”) across the entire user interface by changing just the root node of our visual tree.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_2134B26B.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_156F456C.png" width="500" height="380" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;In this demo I am going to show you a simple tool window displaying process information similar to the Task Manager. I have created two separate packages that use perfectly the same logic except the first one is built with Windows Forms UI, the second with WPF. Let’s start them!&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin:3pt 0cm;" class="BodyText-Normal"&gt;&amp;#160;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_23517D68.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_38EBB605.png" width="660" height="400" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;The two tool windows look similar; however, the WPF is a bit more sophisticated. When clicking on the column headers we can order the table according to the column clicked, and you also can discover alternating row colorings. Of course, you can do the same effect with Windows Forms by using third-party controls, but the WPF data grid does it for you free out of the box. Try to resize the grid columns both for the top and bottom tool windows. You’ll experience that while the transition in WPF (top) window is smooth, the Windows Forms tool is flickering.&lt;/span&gt;&lt;/p&gt; &lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;   &lt;p&gt;&lt;span&gt;I start Spy++ and show you how windows handle are used by the Windows Forms and WPF solutions.&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;[Start Spy++. Use the Find Window function with the Hide Spy++ option.]&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;When I move the target cross over the Windows Forms implementation, you can see that it has two windows within: one for the list view representing the grid and one for the column headers. Now, when I move it over the WPF implementation, you see that the WPF tool window is nested into the main window of VS without any more HWND! By the way, with this technique you can use Spy++ to discover which parts of the new Shell have been moved to WPF and which have not!&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;Let’s back and see the source codes! As I mentioned earlier the two codes are identical except the user interface definitions. This is the code that populates the Windows Forms with process information. As you can see, it contains operations that make this population in the imperative way:&lt;/span&gt;&lt;/p&gt;    &lt;p&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:b2993f1e-8a92-488f-8af2-ae788fc6557b" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Populates the list view control with process data&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; RefreshData()&lt;/li&gt; &lt;li&gt;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;ProcessListView.Items.Clear();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; processInfo &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ProcessList&lt;/span&gt;.GetProcesses())&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; item = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ListViewItem&lt;/span&gt;(&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt;[]&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;processInfo.Name,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;processInfo.Id.ToString(),&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;processInfo.Priority.ToString(),&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;processInfo.ThreadCount.ToString(),&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;processInfo.Priority &amp;lt; &lt;span style="color:#a52a2a;"&gt;8&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;? &lt;span style="color:#a31515;"&gt;&amp;quot;Low (&amp;quot;&lt;/span&gt; + processInfo.Priority + &lt;span style="color:#a31515;"&gt;&amp;quot;)&amp;quot;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;: &lt;span style="color:#a31515;"&gt;&amp;quot;High (&amp;quot;&lt;/span&gt; + processInfo.Priority + &lt;span style="color:#a31515;"&gt;&amp;quot;)&amp;quot;&lt;/span&gt;,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;processInfo.WorkingSet.ToString()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;}) { Tag = processInfo };&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;ProcessListView.Items.Add(item);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;ProcessListView.SelectedItems.Clear();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;ProcessListView.SelectedIndices.Add(&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;ProcessListView.Columns[&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;].AutoResize(&lt;span style="color:#2b91af;"&gt;ColumnHeaderAutoResizeStyle&lt;/span&gt;.ColumnContent);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;ProcessListView.Invalidate();&lt;/li&gt; &lt;li&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;In contrast, the WPF solution does it in a declarative fashion due to the data binding feature:&lt;/span&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:50efce20-e8ad-422c-a278-3cba50c9ff58" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; Binds the grid with process data&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#808080;"&gt;///&lt;/span&gt;&lt;span style="color:#008000;"&gt; &lt;/span&gt;&lt;span style="color:#808080;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ------------------------------------------------------------------------&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; RefreshData()&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;{&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;ProcessGrid.ItemsSource = &lt;span style="color:#2b91af;"&gt;ProcessList&lt;/span&gt;.GetProcesses();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;}&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;}&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;   &lt;p&gt;&lt;span&gt;Here the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;ItemsSource&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt; property of the grid is simply assigned to the collection of process information retrieved by the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;GetProcesses&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt; method.&lt;/span&gt;&lt;/p&gt;    &lt;p&gt;&lt;span&gt;I’m sure, I do not have to tell you which one the simpler is. Let’s have a look at the codes defining the UI. For Windows Forms it is also imperative, the form’s UI is set up by C# code (code extract only):&lt;/span&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:fe1f8f24-50dc-43e6-a7e9-c4db5bf8ff4e" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; InitializeComponent()&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;{&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ListView&lt;/span&gt;();&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.NameHeader = ((System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;)(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;()));&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.IDHeader = ((System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;)(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;()));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ThreadsHeader = ((System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;)(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;()));&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.HandlesHeader = ((System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;)(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;()));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.PriorityHeader = ((System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;)(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;()));&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.WorkingSetHeader = ((System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;)(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;()));&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.SuspendLayout();&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// &lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// ProcessListView&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// &lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.Columns.AddRange(&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;ColumnHeader&lt;/span&gt;[] {&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.NameHeader,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.IDHeader,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ThreadsHeader,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.HandlesHeader,&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.PriorityHeader,&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.WorkingSetHeader});&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.Dock = System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;DockStyle&lt;/span&gt;.Fill;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.FullRowSelect = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.GridLines = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.Location = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Drawing.&lt;span style="color:#2b91af;"&gt;Point&lt;/span&gt;(&lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;, &lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;);&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.Margin = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;Padding&lt;/span&gt;(&lt;span style="color:#a52a2a;"&gt;4&lt;/span&gt;, &lt;span style="color:#a52a2a;"&gt;4&lt;/span&gt;, &lt;span style="color:#a52a2a;"&gt;4&lt;/span&gt;, &lt;span style="color:#a52a2a;"&gt;4&lt;/span&gt;);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.Name = &lt;span style="color:#a31515;"&gt;&amp;quot;ProcessListView&amp;quot;&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.Size = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; System.Drawing.&lt;span style="color:#2b91af;"&gt;Size&lt;/span&gt;(&lt;span style="color:#a52a2a;"&gt;1030&lt;/span&gt;, &lt;span style="color:#a52a2a;"&gt;341&lt;/span&gt;);&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.TabIndex = &lt;span style="color:#a52a2a;"&gt;0&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.UseCompatibleStateImageBehavior = &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ProcessListView.View = System.Windows.Forms.&lt;span style="color:#2b91af;"&gt;View&lt;/span&gt;.Details;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// &lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// NameHeader&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#008000;"&gt;// &lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.NameHeader.Text = &lt;span style="color:#a31515;"&gt;&amp;quot;Process Name&amp;quot;&lt;/span&gt;;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.NameHeader.Width = &lt;span style="color:#a52a2a;"&gt;200&lt;/span&gt;;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;    &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;WPF uses XAML that is declarative (code extract only):&lt;/span&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:4eeac65b-c7a3-4db5-9977-6f559394428b" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Process Name&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Name}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Id&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Id}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Threads&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; ThreadCount}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Handles&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Handles}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Priority&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Priority&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;,&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Converter&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;={&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; PriorityConverter}}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Working Set Size&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; WorkingSet}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Auto&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; ElementStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;StaticResource&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; NumericCellStyle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt; &lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#ff0000;"&gt; SortDirection&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Descending&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/span&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&amp;#160;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;You see the &lt;/span&gt;&lt;span class="ProgramTextChar-Reference"&gt;&lt;span style="font-size:11pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;strong&gt;&lt;font face="Consolas"&gt;Binding&lt;/font&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt; attribute of the columns that assign appropriate property of processes with the corresponding column. This XAML file declares the visual attributes of the UI, and it is very powerful. Just adding a few XAML lines without any coding we can use the styling and templating of WPF to solve tasks we use to code with Windows Forms. Here I uncomment the code that defines “mouse over” behavior for grid cells:&lt;/span&gt;&lt;/span&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:12dc6f12-115b-4647-9cc5-8ad200a2cb7e" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGrid.CellStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; TargetType&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;DataGridCell&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Trigger&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Property&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;IsMouseOver&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Setter&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Property&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Background&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Yellow&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Setter&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Property&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;FontWeight&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Bold&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Setter&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Property&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Foreground&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Maroon&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Trigger&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style.Triggers&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li style="background:#f3f3c9;"&gt;&amp;#160;&amp;#160;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Style&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGrid.CellStyle&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;And also add a new column to the grid:&lt;/span&gt;&lt;/span&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:334b83cc-4ca5-4611-947e-0d9a04055fa0" 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:#fff;overflow:auto;"&gt; &lt;ol style="background:#ffffd5;margin:0;padding:0 0 0 5px;"&gt; &lt;li&gt;&lt;span style="color:#a31515;"&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#a31515;"&gt;DataGridTextColumn&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Header&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Window Title&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Binding&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;{&lt;/span&gt;&lt;span style="color:#a31515;"&gt;Binding&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; WindowTitle}&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; Width&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;*&amp;quot;&lt;/span&gt;&lt;span style="color:#ff0000;"&gt; IsReadOnly&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;True&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;When running the modified tool window, we can recognize the effect of changes:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_0A5E8D2B.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" border="0" alt="image" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/image_5F00_thumb_5F00_2F0FA4A2.png" width="660" height="336" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;span&gt;&lt;font size="3" face="Calibri"&gt;There is a new column in the grid, and as I move the mouse over the cells, the cell colors get changed.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;What I showed you is just a tiny part of benefits coming from WPF but I hope it was enough to convince you to turn to WPF when developing your extensions.&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="Best Practices for Extending the IDE with a focus on Performance, Part 2" href="http://dotneteers.net/blogs/divedeeper/archive/2009/10/20/DevToolEcosystemSummitVSX202Part2.aspx"&gt;Part 2&amp;gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&lt;span style="font-family:&amp;#39;Calibri&amp;#39;,&amp;#39;sans-serif&amp;#39;;font-size:12pt;mso-bidi-font-family:&amp;#39;Times New Roman&amp;#39;;mso-bidi-theme-font:minor-bidi;mso-bidi-font-size:11.0pt;mso-ascii-theme-font:minor-latin;mso-fareast-font-family:calibri;mso-fareast-theme-font:minor-latin;mso-hansi-theme-font:minor-latin;mso-ansi-language:en-us;mso-fareast-language:en-us;mso-bidi-language:ar-sa;"&gt;&amp;#160;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1287" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>Have a look at the new design in Visual Studio 2010</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/19/have-a-look-at-the-new-design-in-visual-studio-2010.aspx" /><id>/blogs/divedeeper/archive/2009/10/19/have-a-look-at-the-new-design-in-visual-studio-2010.aspx</id><published>2009-10-19T18:15:11Z</published><updated>2009-10-19T18:15:11Z</updated><content type="html">&lt;p&gt;I have just installed Visual Studio 2010 Ultimate Beta2. After starting it you face with the new design:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/VS2010Beta2StartPage_5F00_1B7F9FAD.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="VS2010Beta2StartPage" border="0" alt="VS2010Beta2StartPage" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/VS2010Beta2StartPage_5F00_thumb_5F00_13E40A73.png" width="644" height="414" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Also try Extension Manager and New Project…&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1283" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>Visual Studio 2010 Beta2 is available for download</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/19/visual-studio-2010-beta2-is-available-for-download.aspx" /><id>/blogs/divedeeper/archive/2009/10/19/visual-studio-2010-beta2-is-available-for-download.aspx</id><published>2009-10-19T18:09:01Z</published><updated>2009-10-19T18:09:01Z</updated><content type="html">&lt;p&gt;If you have the appropriate MSDN Subscription, you can download Beta2 from now. From official announcement and some mode important dates, please look at Soma’s blog: &lt;a href="http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx"&gt;http://blogs.msdn.com/somasegar/archive/2009/10/19/announcing-visual-studio-2010-and-net-fx-4-beta-2.aspx&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;It is also worth to have a look at to the new design of Visual Studio Gallery that illustrates the new “sexy” design of VS 2010: &lt;a href="http://visualstudiogallery.msdn.microsoft.com."&gt;http://visualstudiogallery.msdn.microsoft.com.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Download, install and enjoy!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1282" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>My sessions on the DevTools Ecosystem Summit</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/18/my-sessions-on-the-devtools-ecosystem-summit.aspx" /><id>/blogs/divedeeper/archive/2009/10/18/my-sessions-on-the-devtools-ecosystem-summit.aspx</id><published>2009-10-18T12:07:06Z</published><updated>2009-10-18T12:07:06Z</updated><content type="html">&lt;p&gt;The DevTools Ecosystem Summit will be held between October 19 and 23 in the Microsoft Conference Center, Redmond. The first two days are open for users after free registration, the other days are organized only for VSIP partners and Inner Circle members. I will present two sessions on the conference:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;VSX 102: &lt;strong&gt;&lt;em&gt;Deploying Visual Studio 2010 Extensions&lt;/em&gt;&lt;/strong&gt; (together with Quan To): Due to the COM roots of Visual Studio and the lack of the right tool set deploying Visual Studio extension requires “creativity” from developers. Visual Studio 2010 is a great leap on this field with its brand new tools and technologies including Extension Manager, Visual Studio Gallery and VSIX. This presentation intends not only to overview of these tools but rather demonstrating how developers can leverage on the synergy of these tools to remove the deployment pain.&lt;/li&gt;    &lt;li&gt;VSX 202: &lt;strong&gt;&lt;em&gt;Best Practices for Extending the IDE with a Focus on Performance&lt;/em&gt;&lt;/strong&gt;: With Visual Studio 2010, creating extensions has never been easier! In this presentation, I will discuss and demonstrate the benefits of leveraging new Visual Studio technologies such as WPF and MEF, and will show how to optimize performance for your extensions.&amp;#160; The talk will cover extensibility best practices with a focus on performance such as keeping your UI responsive, how you can be frugal with resources, and how to lazy-load your extension.&amp;#160; Finally, I will show you how to debug those pesky errors that appear during extension development and how to avoid them in the future.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The post conference videos are promised in a few weeks after the conference, I would encourage you to download and watch them. I also plan to present my sessions in a readable form on my blog.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1277" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author></entry><entry><title>LearnVSXNow! Part #45 – Understanding the Menu Merge Process</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/10/13/LearnVSXNowPart45.aspx" /><id>/blogs/divedeeper/archive/2009/10/13/LearnVSXNowPart45.aspx</id><published>2009-10-13T13:53:00Z</published><updated>2009-10-13T13:53:00Z</updated><content type="html">&lt;p&gt;Visual Studio extensibility developers know that VSPackages are load on-demand. The IDE loads a package when any of the commands, services, tool windows, document windows, designers, or whatsoever objects the package owns are about to be used. Even if our packages are not loaded, somehow they should indicate their presence: &amp;ldquo;Hey, here I am installed with Visual Studio&amp;hellip; Just click on this button and I&amp;rsquo;ll be loaded by the shell to stand at your service&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;Generally packages indicate their presence by inserting menu and toolbar items either into one of the main menus, standard toolbars or context menus. Assemblies of packages hold the information the IDE uses to indicate their presence. The dilemma is the following:&lt;/p&gt;
&lt;p&gt;If the package holds this information, they should be in the memory to extract the information to be displayed by the IDE. Well, this would totally prevent the frugality of the on-demand loading mechanism.&lt;/p&gt;
&lt;p&gt;Visual Studio solves this challenge with the following technique:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Presence information is put into a special binary resource within the assembly representing the package. This is the result of compiling the so-called command table (.vsct file of the package). &lt;/li&gt;
&lt;li&gt;When installing the package, Visual Studio takes this resource information out of the assembly and merges the items described there with the standard menus (of course, including toolbars and context menus) of the IDE. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This sounds simple, but in practice, this mechanism is more complex, because several other issues should also be handled:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Removing or uninstalling packages &lt;/li&gt;
&lt;li&gt;Handling changes in packages &lt;/li&gt;
&lt;li&gt;Packages can be localized for several culture contexts &lt;/li&gt;
&lt;li&gt;Startup performance should not be poor &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Technically the easiest solution was to merge the menu information of all packages during Visual Studio startup time. The IDE could simply load all the command table resources from package binaries and carry out the merging. Well, from user experience point of view this would not ideal. Just think about that Visual Studio ships with more than hundred packages out of the box. The merge process should scan over one hundred assemblies or native packages for command table resources. Are you sure you wanted this process to be done for every VS startup? I&amp;rsquo;d rather believe you would pray for a much faster startup.&lt;/p&gt;
&lt;p&gt;What Visual Studio does is pre-merging the IDE and package menus. With the&lt;strong&gt;&lt;span style="font-family:cons;"&gt; devenv /setup&lt;/span&gt;&lt;/strong&gt; command line you could ask Visual Studio to do the whole merging for you.&lt;/p&gt;
&lt;h3&gt;How Menu Merging Works?&lt;/h3&gt;
&lt;p&gt;Related to a minor bug I changed a few emails with Paul Harrington, a lead dev from the VS platform team. As a tool for finding the bug, Paul wrote me the merging and startup mechanism in details. I used his description to discover how the little cogs work behind the scenes and here I share it with you.&lt;/p&gt;
&lt;p&gt;The menus Visual Studio IDE is about to merge are described in the registry under the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\&lt;em&gt;&amp;lt;instanceRoot&amp;gt;&lt;/em&gt;\Menus&lt;/strong&gt;&lt;/span&gt; key, where &lt;em&gt;&lt;span style="font-family:cons;"&gt;&lt;strong&gt;&amp;lt;instanceRoot&amp;gt;&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt; is the registry root of the Visual Studio instance you work with. For example, for VS 2008 it is &lt;span style="font-family:cons;"&gt;&lt;strong&gt;9.0&lt;/strong&gt;&lt;/span&gt;, for VS 2010 it is &lt;span style="font-family:cons;"&gt;&lt;strong&gt;10.0_Config&lt;/strong&gt;&lt;/span&gt;, for VS 2010 Experimental Instance this key is &lt;span style="font-family:cons;"&gt;&lt;strong&gt;10.0Exp_Config&lt;/strong&gt;&lt;/span&gt;. The next figure illustrates the content of this registry key:&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/MenusRegistry_5F00_15D762F9.png"&gt;&lt;img height="388" width="644" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/MenusRegistry_5F00_thumb_5F00_58C30B99.png" alt="Menus entry in the registry" border="0" title="Menus entry in the registry" 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 key has entries with type of &lt;span style="font-family:cons;"&gt;&lt;strong&gt;REG_SZ&lt;/strong&gt;&lt;/span&gt; for each package having menu resources to be merged with the IDE. Each entry contains a name (like &lt;span style="font-family:cons;"&gt;&lt;strong&gt;Menus.ctmenu&lt;/strong&gt;&lt;/span&gt;) and a version number separated by a comma. When merging the menus, Visual Studio extracts the resources here, creates the merge and saves the result into a file named &lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv.CTM&lt;/strong&gt;&lt;/span&gt; where the extension name stands for &amp;ldquo;Commands, Toolbars and Menus&amp;rdquo;. This file serves as a &amp;ldquo;merged menu cache&amp;rdquo;. When Visual Studio starts, it checks if there is valid &amp;ldquo;merged menu cache file&amp;rdquo; or not. While a valid file is found, the IDE reads the file and uses its cached content to build up the menus. When the file is found invalid, Visual Studio creates the file again by merging the appropriate package resources again.&lt;/p&gt;
&lt;h3&gt;Checking the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv.CTM&lt;/strong&gt;&lt;/span&gt; file&amp;rsquo;s validity&lt;/h3&gt;
&lt;p&gt;During the merge process Visual Studio calculates a checksum from the content of the values under the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;Menus&lt;/strong&gt;&lt;/span&gt; registry key. This checksum value is saved into the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv.CTM&lt;/strong&gt;&lt;/span&gt; file. At startup time the IDE looks for the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv.CTM&lt;/strong&gt;&lt;/span&gt; file in a few folders using the locale IDE of the installed VS language. For the English version this is 1033, for other languages substitute it with the appropriate ID. Folders are searched in the following order:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Local AppData folder&lt;/strong&gt;. Assuming your operating system is installed on drive &lt;span style="font-family:cons;"&gt;&lt;strong&gt;C:&lt;/strong&gt;&lt;/span&gt;, it is &lt;span style="font-family:cons;"&gt;&lt;strong&gt;C:\ProgramData\Microsoft\VisualStudio\&lt;em&gt;&amp;lt;instanceRoot&amp;gt;&lt;/em&gt;\1033&lt;/strong&gt;&lt;/span&gt;. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Per-user local (non-roaming) AppData folder&lt;/strong&gt;. It should be something like &lt;span style="font-family:cons;"&gt;&lt;strong&gt;C:\Users\&lt;em&gt;&amp;lt;userName&amp;gt;&lt;/em&gt;\AppData\Local\Microsoft\VisualStudio\&lt;em&gt;&amp;lt;instanceRoot&amp;gt;&lt;/em&gt;\1033&lt;/strong&gt;&lt;/span&gt;. &lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The folder containing devenv.exe&lt;/strong&gt;. This is the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;Common7\IDE&lt;/strong&gt;&lt;/span&gt; folder under your Visual Studio installation root.&amp;nbsp;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The CTM file is hidden, so you must also display the hidden files if you want to see it in Windows Explorer. Because the local AppData folder and the Visual Studio installation folder require elevated permissions to write into them, there is a high likelihood that you will find this file in your per-user local AppData folder, just like in my case:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/DevenvCTMInLocalAppData_5F00_213F011E.png"&gt;&lt;img height="378" width="644" src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper/DevenvCTMInLocalAppData_5F00_thumb_5F00_2E28BB62.png" alt="Devenv.CTM in my local AppData" border="0" title="Devenv.CTM in my local AppData" 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 the IDE does not find the devenv.CTM file, or find it, but the checksum stored in that file does not equal with the value calculated from the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;Menus&lt;/strong&gt;&lt;/span&gt; key&amp;rsquo;s content, the IDE takes the merged menu file into account as invalid (or obsolete) and starts building up the new merged menu file.&lt;/p&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;The merging process&lt;/h3&gt;
&lt;p&gt;The IDE iterates through the packages registered with the &lt;span style="font-family:cons;"&gt;&lt;strong&gt;Menus&lt;/strong&gt;&lt;/span&gt; key and looks for the localized resources (according to Visual Studio&amp;rsquo;s installation language). Reads the resources and merges the command+toolbar+menu contributions into a master list. When all packages are merged into this list, it is written to the CTM file together with the calculated checksum. The IDE tries to write to the locations (1-3)used to search this file. Because the local AppData folder and Visual Studio installation root require elevated permissions, generally the file is written into the per-user local AppData folder.&lt;/p&gt;
&lt;h3&gt;Relation to &lt;span style="font-family:cans;"&gt;&lt;strong&gt;devenv /setup&lt;/strong&gt;&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;The merging process happening with &lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv /setup&lt;/strong&gt;&lt;/span&gt; is the same as above, but there are a few differences:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv /setup&lt;/strong&gt;&lt;/span&gt; always carries out merging even when the checksums match. &lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv /setup&lt;/strong&gt;&lt;/span&gt; must be run with elevated permissions, so it should always be able to write to the local AppData folder. &lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:cons;"&gt;&lt;strong&gt;devenv /setup&lt;/strong&gt;&lt;/span&gt; creates the merged menu file for all installed languages. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I hope, these details will help you understand how your extensions&amp;rsquo; commands, menus and toolbars are merged into the UI of Visual Studio and also give you starting point for troubleshooting.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1271" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author><category term="VS 2008" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VS+2008/default.aspx" /><category term="VSX" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VSX/default.aspx" /><category term="VS 2010" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VS+2010/default.aspx" /></entry><entry><title>Visual Studio 2010 and .NET 4.0 Book with Dotneteers</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/09/26/VS2010Net4SixInOne.aspx" /><id>/blogs/divedeeper/archive/2009/09/26/VS2010Net4SixInOne.aspx</id><published>2009-09-26T08:15:00Z</published><updated>2009-09-26T08:15:00Z</updated><content type="html">&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;It is a great thing to announce that Dotneteers&amp;nbsp;are now involved in the authoring team of a new book with working title &amp;ldquo;Visual Studio 2010 and .NET 4.0 Six-in-One&amp;rdquo;. The book is to be published by Wrox in Q1 next year in a team work of ten, including well-known authors, Hungarian MVPs and community members. Here is the list of authors in alphabetical order:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Bal&amp;aacute;ssy, Gy&amp;ouml;rgy&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Gr&amp;aacute;nicz, &amp;Aacute;d&amp;aacute;m&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Hajdrik, Attila&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Hillar, Gaston&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Kanjilal, Joydip&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Moln&amp;aacute;r, &amp;Aacute;gnes (OBA, Sharepoint and Aghy)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Nov&amp;aacute;k, Istv&amp;aacute;n (DiveDeeper VSX)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Sellers, Mitch&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Smulovics, P&amp;eacute;ter (My.Mountains[])&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="BulletedList1" style="margin:3pt 0cm 3pt 35.85pt;"&gt;&lt;span style="font-family:&amp;#39;Wingdings 2&amp;#39;;color:#365f91;mso-fareast-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-bidi-font-family:&amp;#39;Wingdings 2&amp;#39;;mso-themecolor:accent1;mso-themeshade:191;"&gt;&lt;span style="mso-list:Ignore;"&gt;&lt;span style="font-size:small;"&gt;&lt;/span&gt;&lt;span style="font:7pt &amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;Velv&amp;aacute;rt, Andr&amp;aacute;s (VBandi&amp;rsquo;s musings on WPF, Silverlight and UX)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;When we have any news and more information about the book, I will share those with you.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;/span&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=1204" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author><category term="VSX" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VSX/default.aspx" /><category term="C#" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/C_2300_/default.aspx" /><category term=".NET" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/.NET/default.aspx" /><category term="WPF" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/WPF/default.aspx" /></entry><entry><title>VS 2010 Beta1 Issues #3: Cancel Button in Extension Manager</title><link rel="alternate" type="text/html" href="/blogs/divedeeper/archive/2009/07/05/VS2010Beta1IssuesPart3.aspx" /><id>/blogs/divedeeper/archive/2009/07/05/VS2010Beta1IssuesPart3.aspx</id><published>2009-07-05T12:31:00Z</published><updated>2009-07-05T12:31:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size:small;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;"&gt;The new Extension Manager is a great piece of Visual Studio 2010, I like the UI (even if it has fuzzy font by default &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:Wingdings;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-latin;mso-hansi-font-family:Calibri;mso-hansi-theme-font:minor-latin;mso-char-type:symbol;mso-symbol-font-family:Wingdings;"&gt;&lt;span style="mso-char-type:symbol;mso-symbol-font-family:Wingdings;"&gt;J&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Calibri;"&gt;), but I have found that it has a button name &lt;b style="mso-bidi-font-weight:normal;"&gt;Cancel&lt;/b&gt;. I&amp;rsquo;d rather name this button &lt;b style="mso-bidi-font-weight:normal;"&gt;Close&lt;/b&gt;, because it does not behave like &lt;b style="mso-bidi-font-weight:normal;"&gt;Cancel&lt;/b&gt; in other places.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;"&gt;&lt;img src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper.VS2010Beta1Issues-3/ExtensionManager1.png" alt="" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;For me, the name &amp;ldquo;cancel&amp;rdquo; suggest that by clicking it I can roll back any changes I have made on this dialog. When the Extension Manager appears on the screen, &lt;b style="mso-bidi-font-weight:normal;"&gt;Cancel&lt;/b&gt; tells me this.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span style="mso-ansi-language:HU;mso-fareast-language:HU;mso-no-proof:yes;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;When I click on Cancel, no changes are saved, and the dialog simply closes. However, when I make some changes, for example remove one of the installed extensions, I face with the following dialog:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&lt;img src="http://dotneteers.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/divedeeper.VS2010Beta1Issues-3/ExtensionManager2.png" alt="" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span style="mso-ansi-language:HU;mso-fareast-language:HU;mso-no-proof:yes;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span style="font-family:Calibri;font-size:small;"&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;br /&gt;Here the &lt;b style="mso-bidi-font-weight:normal;"&gt;Cancel&lt;/b&gt; button is a bit misleading, you may think you can undo the uninstall operation by clicking on it. It might be suspicious that clicking the Cancel button does not ask you a confirmation, but simply closes the dialog. Actually the message with the light yellow background tells you that &amp;ldquo;some extensions have been changed&amp;rdquo;, but it does not explicitly tell that those cannot be simply rolled back.&lt;/p&gt;
&lt;/span&gt;&lt;/span&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;/p&gt;
&lt;p class="MsoNormal" style="margin:3pt 0cm;"&gt;&lt;span&gt;The same happens if you use the &lt;b style="mso-bidi-font-weight:normal;"&gt;Disable&lt;/b&gt;/&lt;b style="mso-bidi-font-weight:normal;"&gt;Enable&lt;/b&gt; buttons for an installed extension. Renaming the &lt;b style="mso-bidi-font-weight:normal;"&gt;Cancel&lt;/b&gt; button to &lt;b style="mso-bidi-font-weight:normal;"&gt;Close&lt;/b&gt; would make the situation clear, because it would not implicitly suggest you that you can undo the changes you&amp;rsquo;ve done using the Extension Manager.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://dotneteers.net/aggbug.aspx?PostID=957" width="1" height="1"&gt;</content><author><name>inovak</name><uri>http://dotneteers.net/members/inovak/default.aspx</uri></author><category term="VSX" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VSX/default.aspx" /><category term="VS 2010" scheme="http://dotneteers.net/blogs/divedeeper/archive/tags/VS+2010/default.aspx" /></entry></feed>