Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio add custom command to run in Package Manager Console?

I am trying to create a button which will automatically run few powershell commands which are imported in nuget package (tools in nuget package)

I found out how to add custom button in this question: How can I add a custom command to Visual Studio?. But I cannot find out how to run from this command in package manager console.

So is there a way to add custom command button to visual studio, which will start and run command in package manager console?

like image 352
Piotr Stapp Avatar asked Jun 19 '13 08:06

Piotr Stapp


1 Answers

Using a custom command described by link, you can run only external tools. In your case, you can run NuGet command line utility. First, you need to download nuget.exe. Then you have to add a custom command, arguments for it and initial directory in External Tools dialog. You can use solution variables (e.g., $(ProjectFileName), $(SolutionDir)) for arguments and initial directory fields. You can use bat file to run few commands.

Unfortunately, the NuGet command line utility has fewer features than package manager console. I don't know, is it enough of these features to solve your issue?

To use all features of NuGet and to integrate into Visual Studio, you can implement your VSPackage. From VSPackage you can add at any place of Visual Studio the custom command (as a button or menu item). When the command launch (user clicked your button), you can call any method of NuGet API inside Visual Studio. This way requires time to develop and not so simple.

like image 116
Mikhail Shcherbakov Avatar answered Oct 20 '22 16:10

Mikhail Shcherbakov