Powering Visual Studio with the power of PowerShell, StudioShell


Today's project from Jim Christopher shows turns how you interact with the Visual Studio IDE on its ear, from click, click, click, to type, type, type. From macro's (in those versions of Visual Studio that still support them) to the power of PowerShell. Best of all, the source for the entire project is available too!



StudioShell's goal is to fundamentally change the way you interact with Visual Studio and your code.

If you’ve ever implemented a Visual Studio extension, such as an add-in or a package, you know how convoluted this space has become. You have to become an expert in your tooling if you want to change it. StudioShell changes this landscape by exposing many of Visual Studio’s extensibility points in a simple and consistent way. It makes the Visual Studio IDE interactive and discoverable.

What an add-in does in a compiled binary, StudioShell can accomplish with a one-liner.



Support for standard PowerShell profile scripts, as well as StudioShell profile scripts - customize your StudioShell session as you would any other PowerShell session.

Manage your projects, references, breakpoints, stack frame locals, menus, toolbars, Visual Studio settings, IDE windows, and even your code from PowerShell scripts, all in a consistent and discoverable way.

Solution Modules - save your StudioShell and IDE customizations as a PowerShell module in your solution, and it will automatically be imported into your StudioShell session when the solution is loaded.

Simple visualization controls you can invoke from the console - create a graph of project code statistics with one line of script.

Fully integrated context-sensitive help.

Host indifference - StudioShell features can be used from any suitable PowerShell host, including NuGet, the standard PowerShell console, and the Integrated Scripting Environment.

Current Release

The current release of this project is StudioShell 1.6.4. This release has been classified as "stable" and is recommended for use over previous releases.

The StudioShell DTE provider is now available as a NuGet package for Visual Studio 2010, 2012, and 2013. This package provides access to the DTE:/ drive from the package manager console without the overhead of installing the entire StudioShell environment.

Special thanks to Avi Haiat for helping get the 2013 support off the ground.

Getting Involved

There are several ways you can get involved in this project:

  1. Contribute your scripts to the StudioShell.Contrib project.

  2. Use StudioShell and log any issues using the Issue Tracker.

  3. If you are interested in expanding support for the SSMS object model in StudioShell, please contact the project coordinator.

  4. If you are interested in expanding the DTE provider with additional features of the Visual Studio service offering, please contact the project coordinator.

Check out these videos of StudioShell in action

For me, the quickest way to grok something like this is to play with examples. Luckily Jim has that covered.

Documentation Go Examples

These examples are by no means comprehensive, but they should serve as a general guide for getting around in StudioShell, including finding things, getting help, and using the standard PowerShell cmdlets.

Navigating the DTE drive

This example shows the root of the DTE drive:

C:\PS> ls -path dte:

This example lists all projects in the current solution:

C:\PS> ls -path dte:\solution\projects

This example navigates to the breakpoint node:

C:\PS> cd dte:/debugger/breakpoints

Getting Help ...

Standard PowerShell Cmdlets

  • Projects and Items ...
  • Window Configurations ...
  • Breakpoints ...
  • Commands ...
  • Command Bars ...

Errors ...

Visualizations ...

Here's a couple snaps of these running on my system;







Deeply integrates Visual Studio extensibility features with a PowerShell session.


StudioShell exposes most of the IDE and programmatic features of Visual Studio as part of a PowerShell provider. In addition, StudioShell adds several behaviors to Visual Studio that simplify using PowerShell as a way to interact with your code, projects, and IDE.
StudioShell supports the following features:

Profile Scripts

StudioShell fully supports for your existing PowerShell profile scripts. In addition, you can save customizations that are specific to StudioShell in a StudioShell profile script.


Solution Modules

StudioShell recognizes a special PowerShell module located in a solution as a "Solution Module". These Solution Modules are automatically imported when the solution is loaded into the IDE, and removed when the solution is closed, making them a great way to save StudioShell customizations on a per-solution basis.


DTE Drive

StudioShell surfaces most of the Visual Studio extensibility features through a special PowerShell drive named "dte". This drive allows you to access things like the IDE windows, menus, projects, files, and code as if they were just files on your hard drive.


PowerShell-based IDE Commands

PowerShell scripts can be invoked by Visual Studio IDE elements, such as menus and toolbar buttons. You can create elaborate and powerful UI customizations using nothing but PowerShell.


Data Visualizations

StudioShell includes several simple data visualization cmdlets that make quick work of summarizing or organizing data from your PowerShell session.


Automatic Variables

StudioShell extends the PowerShell session with several variables that track certain Visual Studio states, such as the currently selected project or code element, the active window, or the current stack frame.


Host Agnostic

StudioShell includes two basic consoles - one that docks in the Visual Studio IDE and the default process I/O console. However, StudioShell is designed to provide access to the Visual Studio extensibility features in any PowerShell console.



StudioShell provides two consoles, an integrated console window that docks in the Visual Studio UI, and the default process console that behaves like the standard PowerShell executable. However, you can use StudioShell from almost any PowerShell host.

From the StudioShell console:

You do not need to do anything to use StudioShell features from one of the included consoles. These consoles load the StudioShell module automatically.

From NuGet, PowerGUI VSX, or the PowerShell console:

Open your console and type:

import-module studioshell

This will load the studioshell module into your PowerShell host, run any initialization scripts necessary, and set up the DTE provider inside of your chosen host.


Finally here's a quick example that shows how StudioShell isn't just a read-only solution, but read-write.


  1. Open the StudioShell console using the instructions in USING STUDIOSHELL.
  2. Open a solution you've been working on recently.
  3. In the StudioShell console, type the following (note that the example spans several lines for readability, but you should enter this as one line):

dir dte:/solution/codemodel -recurse | where { $_ -match 'class' } | set-itemproperty -name Comment -value "updated by StudioShell"

This will place a comment before every class in your solution.

As you've seen in the snaps above, StudioShell's source is available and the project is very welcoming, and acknowledging, of additional contributors...


The Discussion

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.