.NET Zone is brought to you in partnership with:

I’ve been a Windows developer since 3.0 and caught the Visual Basic wave early with v1. I’ve released a “production” application in every version of VB since then (except VB for DOS). Focusing on enterprise, line-of-business development I’ve built Call Center Applications, Mortgage finance systems, Customer Relationship Management tools and more recently I’ve been in the Litigation Support/Electronic Data Discovery/Electronically Stored Information space. Greg is a DZone MVB and is not an employee of DZone and has posted 440 posts at DZone. You can read more from them at their website. View Full User Profile

WPF is To PowerShell as The PowerShell ISE is To Extensibility

04.20.2013
| 3104 views |
  • submit to reddit

Precision Computing - Creating Add-ons, Plugins, and Tools for the PowerShell ISE

We frequently get questions asking if the PowerShell ISE supports a feature that it doesn’t. For example, variable watch windows, function browsers, or “find all matches in the current document”.

Or as another example, many of you are very familiar with Visual Studio and naturally wish for Visual Studio feature <x>. That <x> is usually different for each person :) The Visual Studio team is many times larger than the PowerShell team, and they’ve had a 15-year head start.

When preparing for PowerShell V3, we realized that the appetite for new functionality in the ISE would far outstrip our ability to create it, so we designed one of the most (until now) un-heralded features in the PowerShell ISE: the ability to create custom tool windows:

image

See the “Find All” pane on the right-hand side? That didn’t come with the ISE.

Creating a PowerShell ISE Add-In / Plugin is very straight-forward. Jason gives a great overview in his blog: http://blog.codeassassin.com/2012/01/16/create-a-powershell-v3-ise-add-on-tool/.

The design center of ISE plugins are that they are really just WPF UserControls. In addition, they implement the IAddOnToolHostObject interface.

...

After that, the control is all yours.

You have full access to WPF, XAML, C#, and anything else you can imagine or would expect from a WPF control. For example, here is the simplistic XAML used to create the control in the ‘Find All’ window shown above:

...

All-in-all, a very easy development experience.

Once you’ve compiled a DLL, adding it to the ISE is as easy as:

..."

I though this post a great example of how easy it can be to extend the PowerShell ISE. I love seeing tools being extensible like this...

Published at DZone with permission of Greg Duncan, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)