简体   繁体   中英

Package Manager Console Automation using DTE in Visual Studio

I am trying to automate the Package Manager Console window in Visual Studio 2012. I am DTE object to achieve the same. By using below code line I am able to open the Package Manager Console window.

DTE.ExecuteCommand("View.PackageManagerConsole");

Now I want to pass few parameter to this window. Basically below parameter I want to pass

add-migration 'migrationName'

I also want to pass the default project name to the PMC window.

Please help me to achieve this functionality.

Thanks!

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

var script = "function global:SaveAll {write-host \"All files saved.\"} SaveAll";
_ObjDTE.ExecuteCommand("View.PackageManagerConsole", script);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM