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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With