Accessing Visual Studio’s Automation API From PowerShell

May 16, 2010

in DTE,F#,PowerConsole,PowerShell,VS 2010,Visual Studio,Visual Studio 2010,Visual Studio Automation

Kurt Schelfthout blogs Accessing Visual Studio’s Automation API from F# Interactive and reasons:

Because why anyone would want to write VBA in the Visual Studio macro editor is beyond me.

I agree!

Kurt lays out  the “how to” for injecting the Visual Studio’s DTE object (Development Tools Extensibility) into the F# console. He also provides the link to Visual Studio .NET Automation Object Model.

PowerShell PowerConsole

Makes accessing the Automation API simple. It brings the Visual Studio DTE automation object to your finger tips. Check this post for downloading PowerConsole – PowerShell Integrated with Visual Studio 2010.

$DTE.Solution.Projects | ForEach {$_.Fullname}

PS> $DTE.Solution.Projects | ForEach {$_.Fullname}

C:\PoShScripts\NYC Code Camp\CSharp\WPF+PoSh\Simple\Simple.csproj

C:\PoShScripts\NYC Code Camp\CSharp\WPF+PoSh\PowerShellExtensions\PowerShellExtensions.csproj

C:\PoShScripts\NYC Code Camp\CSharp\WPF+PoSh\HostAndAddVariables\HostAndAddVariables.csproj

{ 1 trackback }

Ruby wrapper for Twitter Search API – GIANT ROBOTS SMASHING INTO … | Ruby WebDev Insider
05.16.10 at 6:30 pm

{ 4 comments… read them below or add one }

Charlie Robbins 05.16.10 at 3:33 pm

Where’s my pails update? :)

Doug Finke 05.16.10 at 5:30 pm

Haven’t forgotten. This is the rabbit hole as it currently stands :)

Kurt Schelfthout 05.17.10 at 7:14 am

Good stuff, this PowerConsole.

Does it use roughly the same method as in my post to find out which VS instance to connect to?

Doug Finke 05.17.10 at 12:46 pm

Kurt, good question. Don’t know. I haven’t used reflector on PowerConsole yet. It is implemented as a 2010 extension, so my guess is it uses MEF to find the DTE services and injects it into the PowerShell runspace as a variable.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Contrat Creative Commons

© 2007-2012, Doug Finke