Using PowerShell, you interact with .NET objects during debugging in the Visual Studio IDE.
The PowerShell Visualizer injects objects, presents a scripting window. And more....
Decorate your classes like so:
Hit a breakpoint, launch a PowerShell session and operate on that object.
Create a custom visualizer by inheriting from the PoSHVisualizer.
Inject variables you want into the PowerShell environment.
- Copy these files to C:\Program Files\Microsoft Visual Studio 8\Common7\IDE for VS 2008
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
- Add a reference to PoSHVisualizer.dll
- Add a reference to Microsoft.VisualStudio.DebuggerVisualizers.dll
- Add the using statement using System.Diagnostics;
The project TestCustomDV
in the download is an example.
Out of the box, the editing area has two ways to execute PowerShell commands that have been typed in.
The default is immediate mode. As you type, the script is immediately
executed. You can toggle this by either
right clicking the edit area and clicking on the context menu or use the shortcut keys Ctrl-Shift-I.