Introduction to the Visual Studio 2008 Shell (Cont.)
What You Need to Download
The August 2007 CTP release of the Visual Studio 2008 SDK is the first release of the SDK that supports development for the VS Shell (isolated mode). Aside from Visual Studio itself, it is the only software package you need to download and install to start developing and testing your own Shell instance.
When you are ready to deploy and test the setup program of your Shell instance, you will need to download one of the redistributable packages, depending on which Shell mode you are targeting:
- Visual Studio 2008 Shell (isolated mode) Redistributable Package
- Visual Studio 2008 Shell (integrated mode) Redistributable Package
Table 1 summarizes purposes of the different software packages related to Visual Studio Extensibility. When we release these packages, you will find download links from the Visual Studio Extensibility Developer Center (http://msdn.com/vsx).
Walkthrough: Creating Your First Tools IDE on VS Shell (Isolated Mode)
In this walkthrough, I will show you how to create your own IDE based on the Shell (isolated mode), how to do basic customizations of it, and how to create a simple package for your new IDE that simply brings up a Tool Window. I will also briefly discuss how to deploy your VS Shell-based product.
Note that this article is written based on the Visual Studio 2008 SDK August CTP release. The August CTP is the first Visual Studio SDK that supports development on the isolated shell. Because our team ships new releases of the VS SDK quite frequently, it is quite likely that by the time this article is published, there will be a newer release of the VS SDK with an improved Shell development experience. So the details of the step-by-step instructions may become obsolete. If you run into trouble, you should go to the Visual Studio Extensibility Center for help (http://msdn.com/vsx).
Creating Your Own IDE
First you’ll create your own stub .exe for your IDE. Start Visual Studio as an administrator. If you are running Windows Vista, you will need to right-click on the Visual Studio 2008 program shortcut and choose Run as administrator. Future releases of the SDK may not require this, but this is required for the August CTP. In Visual Studio, click File > New Project…, and go to the Visual C++ node in the Project types pane and select Visual Studio Shell. Note that future VS SDK releases should have this template moved under the Extensibility node. Name your project MyFirstShell and click OK, as shown in Figure 2.
Figure 2: Visual Studio Shell template in the New Project dialog box.
Visual Studio will generate a solution with two projects for you: MyFirstShell and MyFirstShellUI. Right after Visual Studio has generated the solution you can just hit F5 to start running your IDE. Of course, it has nothing right now, and it’s not very interesting, but it will run. Figure 3 shows your new un-customized IDE.
Figure 3: Un-customized IDE based on the VS Shell.
Your IDE may look plain right now, but a lot of things just happened. Visual Studio not only built your project, it also ran a tool called DependencyChecker.exe in a post-build step that checked to see if your IDE has been properly set up in the registry. Since this is the first time you are running the IDE, it called MyFirstShell /setup for you to do all the things that are necessary to set up the registry. But wait a minute, you haven’t written a single line of code, let alone handling /setup as an argument-what happened? The VS SDK ships a DLL called AppEnvStub.dll that exports three functions: Start, Remove and Setup, and Setup knows how to set up the registry information when called. The VS Shell template also created code for you to handle the /setup argument that calls into the Setup function exported by AppEnvStub.dll. You can see this (Figure 4) around line 100 of MyFirstShell.cpp.
Figure 4: Generated code sowing the use of Setup function exported from AppEnvStub.dll.
If you now open a registry editor and browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\AppEnv\9.0\Apps\, you can see that you have just created a new key under this node (Figure 5). This is your IDE’s own registry hive that is isolated from Visual Studio or other IDEs that are built on the Shell. In effect, you have just created your own AppId.
Figure 5: Registry hive created by your IDE
Now that you have just created your own IDE, it’s time for you to do some customizations.
VSX Team Member
Development Tools Ecosystem
It’s great to be on the Development Tools Ecosystem marketing team. We work with so many innovative, talented developers who build on the Visual Studio platform. I’m responsible for product management and business development around Visual Studio extensibility, so I’m focused on new opportunities for developers who extend our tools. I’m always interested in hearing about what people are building!