Compartilhar via


How do I pick what features are included in my VS Shell (isolated) based application?

Since releasing the VS 2008 Shell (isolated), we have been working on service pack 1 with a number of significant improvements, including a reduced redistributable size. But the most common questions we hear from developers is "How do I go about picking exactly what features and components are included in my isolated Shell based application?"

This is the subject of this post.

Using .pkgundef

When you create an Visual Studio Shell Isolated project, one of the files that gets created for you is called <yourProjectName>.pkgundef.

image

By default, this file is blank, but you can use this as a reverse registry file. What that means is that any registry keys you put into this file will be removed for you. Of course, this file only works for the registry keys that is owned by your shell based application (i.e. everything under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppEnv\9.0\Apps\<YourShellName+RandomGUID>\).

To give you a concrete example, if I wanted to remove the Class View tool window, I would add this entry in my .pkgundef file:

[$RootKey$\ToolWindows\{C9C0AE26-AA77-11d2-B3F0-0000F87570EE}]

The symbol @ROOTKEY replaces HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppEnv\9.0\Apps\<YourShellName+RandomGUID>\ and you can specify any key under it to be removed.

What to Remove and How?

In the above section, we have talked about how .pkgundef works. But when you are customizing your isolated shell, what are the things you can remove? Here is a list of things you would typically want to remove:

  • VS Packages
  • Tool Windows
  • Menus and Commands

We will discuss each item in its own separate section.

VS Packages

If all the functionality that you don't need is contained inside a VS Package, the cleanest thing to do is to unregister it. Since other things like tool windows, editors, VS Services, menus/commands, etc. that are supplied by that VS package will also be removed when that package is removed, you won't need to remove them separately.

As an example, I can put the following entry in my .pkgundef file to remove the web project system package:

[$RootKey$\Packages\{39c9c826-8ef8-4079-8c95-428f5b1c323f}]

As a result of this, all the related menus/commands, tool windows, editors, VS services, and anything else that's tied to this package will also be removed. If you try the above example to remove the web project system package, you will notice that the command under File > New... > Web Site... will be removed.

So how do I figure what packages can be removed? You can use regedit and enumerate all the packages under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppEnv\9.0\Apps\<YourShellName+RandomGUID>\Packages\. For your convenience, I am including all of them in the table below for you to see.

 

Feature Area

Raw Package Name

Package GUID

Core IDE Packages Undo Package {1D76B2E0-F11B-11d2-AFC3-00105A9991EF}
Visual Studio Environment Package {DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}
Visual Studio Commands Definition Package {44E07B02-29A5-11D3-B882-00C04F79F802}
Visual Studio Directory Listing Package {5010C52F-44AB-4051-8CE1-D36C20D989B4}
Visual Studio Common IDE Package {6E87CFAD-6C05-4adf-9CD7-3B7943875B7C}
Visual Studio Environment Menu Package {715F10EB-9E99-11D2-BFC2-00C04F990235}
Visual Studio COM+ Library Manager Package {ED8979BC-B02F-4da9-A667-D3256C36220A}
Visual Studio Source Control Integration Package {53544C4D-E3F8-4AA0-8195-8A8D16019423}
Visual Studio Solution Build Package {282BD676-8B5B-11D0-8A34-00A0C91E2ACD}
Text Management Package {F5E7E720-1401-11d1-883B-0000F87579D2}
Visual Studio VsSettings Package {F74C5077-D848-4630-80C9-B00E68A1CA0C}
Help Visual Studio Help Package {4A791146-19E4-11D3-B86B-00C04F79F802}
Task List Visual Studio Task List Package {4A9B7E50-AA16-11d0-A8C5-00A0C921A4D2}
Macros Visual Studio Macros Package {A659F1B3-AD34-11d1-ABAD-0080C7B89C95}
Class Outline Class Outline Package {21af45b0-ffa5-11d0-b63f-00a0c922e851}
Toolbox Controls Installer Microsoft.VisualStudio.IDE. ToolboxControlsInstaller. ToolboxInstallerPackage {2c298b35-07da-45f1-96a3-be55d91c8d7a}
ToolBox Control Installer Package {36839529-3AF3-47fa-8194-F4A3FA9F0ED7}
Web Projects Visual Basic Compiler Package {019971D6-4685-11D2-B48A-0000F87572EB}
Microsoft.VisualStudio.Web. Application.WAPackage, Microsoft.VisualStudio.Web.Application, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a {349C5850-65DF-11DA-9384-00065B846F21}
Visual Web Developer Project System Package {39c9c826-8ef8-4079-8c95-428f5b1c323f}
Visual Web Developer Project Persistance Package {8FF02D1A-C177-4ac8-A62F-88FC6EA65F57}
Visual Web Developer Web Migration Package {C1DAB116-2D63-493a-B970-10D7DD0B476E}
Visual Web Developer Web Package {e7f851c8-6267-4794-b0fe-7bcab6dacbb4}
Visual Web Developer Web Application Upgrade Package {DC7F691A-91FC-4F7b-923E-FE829C3A18DC}
HTML Editor Visual Studio HTM Editor Package {1B437D20-F8FE-11D2-A6AE-00104BCC7269}
Visual Web Developer HTML Source Editor Package {BFCC0C3C-6F87-4285-A6C8-BB616061800D}
CSS Editor Visual Studio CSS Editing Package {A764E895-518D-11d2-9A89-00C04F79EFC3}
XML Editor Visual Studio XML Editor Package {87569308-4813-40a0-9cd0-d7a30838ca3f}
Web Browser Visual Studio Web Browser Package {e8b06f41-6d01-11d2-aa7d-00c04f990343}
Binary Editor Visual Studio Binary Editor Package {5B98C2C0-CD7B-11D0-92DF-00A0C9138C45}
Windows Forms Designer Windows Forms Designer Hosting Package {68939055-38e0-4d17-92cb-8909710d8178}
Windows Forms Designer Package {7494682b-37a0-11d2-a273-00c04f8ef4ff}
Windows Forms Designer Resources Package {7b5d447b-0b12-41ea-a84e-c822034422d4}
Windows Forms Application Configuration Package {80c7728b-70a6-4528-8669-73e02d1b9c41}
ElementHost Designer Package {7eab3c71-59ff-4571-a5f3-643f255fc2e6}
Debugger UI Visual Studio Debugger {C9DD4A57-47FB-11D2-83E7-00C04F9902C1}
Database Tools Visual Database Tools Package {220A4C17-7E7C-4663-BBCC-5E607C6543CD}
Visual Studio Database Tools Designers {EF828E39-70F5-4b8e-A3A0-4C0ECD28A69A}
Visual Studio Data Designers {d6c919aa-1217-41e2-a13b-9b92e1866305}
Visual Studio Data Package {E1AA7737-69BE-43d0-A425-E3097651E192}
Visual Studio Data Designer Extensibility Package {A8F602E2-40CE-4daf-AE82-A457A91728B9}
Visual Studio Explorers and Designers Package {8D8529D3-625D-4496-8354-3DAD630ECC1B}
Microsoft Report Designer {F3A96850-E2AE-4e00-9278-8FE23F225A0D}
Microsoft.VisualStudio.Data.Providers. SqlEverywhere.VsPackage, Microsoft.VisualStudio.Data.Providers. SqlEverywhere, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a {b65e9356-a4c7-4855-96bb-1d3ec8514e8f}
Microsoft.VisualStudio.DataDesign. SyncDesigner.DSL.SyncDesignerPackage, Microsoft.VisualStudio.DataDesign. SyncDesigner.DslPackage, Version=9.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A {c8afb2f4-bff7-4055-926d-d44afecd5832}
DSL Runtime Microsoft.VisualStudio.Modeling.Shell. CommonModelingPackage, Microsoft.VisualStudio.Modeling.Sdk.Shell, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a {d1091694-ea72-4bdd-8918-78324cc25448}
Microsoft.VisualStudio.TextTemplating. VSHost.OrchestratorPackage, Microsoft.VisualStudio. TextTemplating.VSHost, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a {a9696de6-e209-414d-bbec-a0506fb0e924}
SourceSafe Support Visual SourceSafe Provider Package {AA8EB8CD-7A51-11D0-92C3-00A0C9138C45}
Visual SourceSafe Provider Stub Package {53544C4D-B03D-4209-A7D0-D9DD13A4019B}
WPF Designer Microsoft.VisualStudio.Internal. WPFFlavor.WPFPackage, Microsoft.VisualStudio.WPFFlavor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a {b3bae735-386c-4030-8329-ef48eeda4036}
Microsoft.VisualStudio.Xaml {e58c2a8b-bcc4-4559-ad59-d62eb6d58a22}
Visual Studio Code Snippets Package {0B680757-2C29-4531-80FA-535A5178AA98}
Managed Language Project Support Visual Studio Component Enumerator Package {588205e0-66e0-11d3-8600-00c04f6123b3}
Visual Studio Settings and Project Designers Package {67909B06-91E9-4F3E-AB50-495046BE9A9A}
Export Template Package {f1e4cfca-4573-4345-8718-7bde2b1f0be8}

Some caveats about removing packages:

  • There are some packages that you should never remove. For example, the ones under "Core IDE" should never be removed because there are many other features that take dependencies on them.
  • The VS Packages above are not refactored in a very granular way right now. What that means is that quite often, you won't be able to remove the entire package. For example, there is no package you can unregister to remove just Class View and all its associated commands/menus, options, services, etc. Class View proffered by the Visual Studio Environment Package, which also proffers other key IDE features Find and Replace, Environment Options pages, Command Window, Output Window, etc.
  • Since I don't have a nice dependency graph to show you. There will be some trial-and-error on your part to see what packages can be removed.

I know this experience is not ideal, and we are working on tooling to make this much easier in the longer term. However, I hope this will still help in the short term.

Tool Windows

For tool windows that you'd like to remove without removing the associated package, you can just add the entry in the .pkgundef file. You can see a list of tool windows by enumerating the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppEnv\9.0\Apps\<YourShellName+RandomGUID>\ToolWindows\

Again, for your convenience, I have listed them here for you.

ToolWindow GUID ToolWindow Name
{0504FF91-9D61-11D0-A794-00A0C9110051} Call Stack
{07CD18B4-3BA1-11d2-890A-0060083196C6} Macro Explorer
{0F887920-C2B6-11d2-9375-0080C747D9A0} Find 1
{0F887921-C2B6-11d2-9375-0080C747D9A0} Find 2
{1CBA9826-3184-4799-A184-784E41B56398} CSS Property Grid
{25f7e850-ffa1-11d0-b63f-00a0c922e851} Document Outline
{269A02DC-6AF8-11D3-BDC4-00C04F688E50} Object Browser
{28836128-FC2C-11D2-A433-00C04F72D18A} Command window
{2D7728C2-DE0A-45b5-99AA-89B609DFDE73} Resource view
{34E76E81-EE4A-11D0-AE2E-00A0C90FFFC3} Output window
{350F9856-A72B-11D2-8AD0-00C04F79E479} Memory
{37ABA9BE-445A-11D3-9949-00C04F68FD0A} Modules
{38ED9834-0C97-445b-BD1D-F78F3E08AFAC} CSS Manage Styles Task Pane
{3AE79031-E1BC-11D0-8F78-00A0C9110057} Solution Explorer
{3FD5E0CC-709A-4f8c-94C3-7F0F8DFF5BB2} Report Datasets
{402DC223-D700-4029-866F-ACEE803F3F0C} CSS Apply Styles Task Pane
{46C87F81-5A06-43a8-9E25-85D33BAC49F8} Help Search
{4A18F9D0-B838-11D0-93EB-00A0C90F2734} Locals
{4A791147-19E4-11D3-B86B-00C04F79F802} Table of contents
{4A9B7E51-AA16-11D0-A8C5-00A0C921A4D2} Task List
{51C76317-9037-4CF2-A20A-6206FD30B4A1} Processes
{53024D34-0EF5-11d3-87E0-00C04F7971A5} Find symbol window
{53544C4D-5C18-11d3-AB71-0050040AE094} LocalChanges
{5415EA3A-D813-4948-B51E-562082CE0887} Call Browser
{56B32054-DE4D-4de3-8396-BCB6F98BD246} Behaviors
{57DC5D59-11C2-4955-A7B4-D7699D677E93} Help Favorites
{588470CC-84F8-4a57-9AC4-86BCA0625FF4} Code Definition Window
{58875C41-862B-4d6f-B046-03E8A333907E} Page Layout
{66dba47c-61df-11d2-aa79-00c04f990343} Dynamic Help
{68487888-204A-11d3-87EB-00C04F7971A5} Find symbol results window
{6B8E94B5-0949-4d9c-A81F-C1B9B744185C} Property Manager
{6FB4A4D9-0C08-4663-AF7B-2ECBDF7A20EC} 'Conditional Formatting
{73F6DD58-437E-11d3-B88E-00C04F79F802} Help index
{73F6DD5B-437E-11d3-B88E-00C04F79F802} Help Index Results
{74946810-37a0-11d2-a273-00c04f8ef4ff} Microsoft.VisualStudio.Designer. Interfaces.IVSMDPropertyBrowser
{74946827-37a0-11d2-a273-00c04f8ef4ff} Server Explorer
{7B8C4981-13EC-4c56-9F24-ABE5FAAA9440} Layers
{873151D0-CF2E-48cc-B4BF-AD0394F6A3C3} Data Source Window
{90243340-BD7A-11D0-93EF-00A0C90F2734} Watch
{A0C5197D-0AC7-4B63-97CD-8872A789D233} Bookmarks
{A693A243-4743-4034-AED4-BEC4E79E0B3B} Web Part Gallery
{A764E899-518D-11d2-9A89-00C04F79EFC3} Style Organizer Tool Window
{A9B00010-7308-415c-95C6-EED62C1B9788} CSS Properties
{B1E99781-AB81-11D0-B683-00AA00A3EE26} Toolbox
{BE4D7042-BA3F-11D2-840E-00C04F9902C1} Breakpoints
{C9C0AE26-AA77-11d2-B3F0-0000F87570EE} Class view
{CA4B8FF5-BFC7-11D2-9929-00C04F68FDAF} Registers
{CF2DDC32-8CAD-11d2-9302-005345000000} FindReplace
{CF577B8C-4134-11D2-83E5-00C04F9902C1} Disassembly
{D78612C7-9962-4B83-95D9-268046DAD23A} Error List
{E62CE6A0-B439-11D0-A79D-00A0C9110051} Threads
{E830EC50-C2B5-11d2-9375-0080C747D9A0} Find in Files
{e8b06f52-6d01-11d2-aa7d-00c04f990343} Web Browser Window
{e8b06f53-6d01-11d2-aa7d-00c04f990343} Web Browser Preview Window
{ECB7191A-597B-41F5-9843-03A4CF275DDE} Immediate window
{EEFA5220-E298-11D0-8F78-00A0C9110057} Properties window
{F2E84780-2AF1-11D1-A7FA-00A0C9110051} Autos
{F62AF5AD-1276-46dd-AE7B-D07AB54D1081} HTML Property Grid
{F78BCC56-71F7-4e7d-8215-F690CAE4F452} Call Browser (secondary)

Typically, you won't need to use the .pkgundef file if you want to remove menus and commands. Instead, you would use the <YourProjectName>.vsct file.

image

If you open this file, you will see that it is a large XML file with lots of things commented out. Here is a snippet of what you will see:

image 

The pattern you will see is that each XML element says No_????Command. If you uncomment the element, the corresponding command or menu will disappear. You can do this quickly inside Visual Studio by highlighting the elements you want to uncomment and use the Ctrl+K, Ctrl+U shortcut.

You can go down this list to pick out the commands/menus that you don't want and uncomment them. For the most part, you should be able to figure out which men/command the XML element corresponds to.

Most of the menus/commands can be removed using the .vsct file. But a small number of them cannot be removed this way. The reason is because this .vsct file only controls the "core" environment commands/menus. For example, if you uncomment every element in the VSCT file and run your isolated shell, you will see that you still have File > New... > Web Site... and Tools > Macros... among several other commands. To remove these, you will need to unregister the web project system package and the macros package respectively.

Summary

I hope this post has given you some insight into how to make the isolated shell work for you. Like I said earlier, we will be making this experience easier with tooling over time. Ideally, you wouldn't even need to touch the .pkgundef or the .vsct file. You should be able to do all of that via checking/unchecking components to indicate what you want/don't want. But before we get there, you will need to do some more low-level work to make the shell work for you!

thanks,
James

Comments