Does Visual Studio add a custom command to run in the package manager console?

I am trying to create a button that automatically launches several powershell commands that are imported into the nuget package (tools in the nuget package)

I learned how to add a custom button to this question: How to add a custom command in Visual Studio? . But I can’t find out how to run this command in the package manager console.

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

+6
source share
1 answer

Using the user command described in the link , you can only run external tools. In your case, you can run the NuGet command-line utility. First, you need to download nuget.exe. Then you need to add the user command, its arguments, and the start directory in the External Tools dialog box. You can use solution variables (e.g. $ (ProjectFileName), $ (SolutionDir)) for the arguments and source fields of the directory. You can use the bat file to run several commands.

Unfortunately, the NuGet command-line utility has fewer features than the package manager console. I do not know if these functions are enough to solve your problem?

To use all the features of NuGet and integrate into Visual Studio, you can implement VSPackage . From VSPackage, you can add a custom command anywhere in Visual Studio (as a button or menu item). When the command starts (the user clicked the button), you can call any NuGet API method inside Visual Studio. This path takes time to develop, and not just.

+2
source

Source: https://habr.com/ru/post/947631/


All Articles