Access the powershell console (package manager console) of visual studio programmatically in an extension Access the powershell console (package manager console) of visual studio programmatically in an extension powershell powershell

Access the powershell console (package manager console) of visual studio programmatically in an extension


The best way for running a script in package manager console is parameter passing into it.

EnvDTE.DTE _ObjDTE;_ObjDTE = (DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE");var script = "function global:SaveAll {write-host \"All files saved.\"} SaveAll";_ObjDTE.ExecuteCommand("View.PackageManagerConsole", script);


There is a Nuget distribution available as Nuget which makes all Nuget functionality easily available, simply get the following http://nuget.codeplex.com/ package and use it.

It also has a PackageManager...

I guess something like that could install something:

 new PackageManager(    PackageRepositoryFactory.Default.CreateRepository("source"),     "path").InstallPackage("packageId")