Visual Studio Shell architecture – Part 1

Before getting into how this new Visual Studio Shell Isolated (let’s call it VSSI for short) thing works, I thought I would go into some background of how Visual Studio works, so you can better understand how your program will work.

When you click on the icon in the start menu to start Visual Studio, you run a program called devenv.exe. Devenv is a short version of development environment or developer environment depending who you talk to. This exe (we call it the stub) will then load a DLL named msenv.dll – and that is where the majority of the work is done. When you launch any other copy of Microsoft development tools, such as the Express editions, the exe name may change, but the same steps are performed. Some customizations are performed by the stub, for example, the splash screen is displayed by the stub (some users of msenv.dll do not display a splash, such as the Macros IDE used by VS) while other customizations, such as the name to show in the title bar, are passed between the stub and msenv.dll. These values are passed through by an exported function in msenv.dll and this function is responsible for creating the main window, starting the message pump for the window, and doing all the work that is common among all callers of msenv.dll.

When you install the next version of the VS SDK, a new Starter Kit and a couple DLLs will be installed onto your computer. The starter kit will create three projects for you, one project will create an exe which will be compiled into a program that loads and runs your customized version of VSSI. One project contains the “command used” data (we will discuss this in a future post), and a package that you can put code that is specific to your VSSI instance and not intended to in in, for example, Visual Studio. When you run the exe project it will look for a DLL named appenvstub.dll - AppEnv was the internal name before we spent a lot of time thinking up the name Visual Studio Shell Isolated, and the name of this DLL will probably change before we ship it. When appenvstub.dll is found it is loaded, then the exe will call one of three methods, Start, Setup, or Remove to either (shockingly) start the application running, setup registry data, or remove registry data. You will pass the command line switches and the name of your application to one of these three methods. Appenvstub.dll will then perform all the work that a program such as devenv.exe or csexpress.exe currently does, which is package up all the data necessary to send over to msenv.dll, display the splash screen, and then start things running. Packaging up this data and running is not easy to do, so Appenvstub.dll acts as a translator between your exe and msenv.dll by bringing in data stored in the registry. This data from the registry is found by the name passed to the functions exported by appenvstub.dll.

Just a few of the posts that I will be making in the future include (more will be added to this list over time):
• The code generated by the template
• How we create the registry (or how you install without installing)
• Customizing your application
• Command used files
• Converting existing packages for VSSI
• Installing Visual Studio Shell Integrated and Isolated
• Choosing the right install model