Community.VisualStudio.Toolkit icon indicating copy to clipboard operation
Community.VisualStudio.Toolkit copied to clipboard

BuildAction: Pack

Open AchimStuy opened this issue 2 years ago • 3 comments

I would like to trigger build action pack (available for ProjectTypes.DOTNET_CORE. As I don't see any builtin functionality, I would implement it and create PR, but need some help:

I would extend BuildAction enum with Pack. But then in GetBuildFlags() I don't find the right value of VSSOLNBUILDUPDATEFLAGS to return. How is Visual Studio providing the command? grafik

AchimStuy avatar Apr 11 '22 08:04 AchimStuy

I'm only guessing, but the command is probably provided by an internal extension rather than as part of the core Visual Studio SDK. As you mentioned, "packing" a project can only be done for .NET SDK-style projects, so it's not really a generic type of command that could apply to other types of projects like building and cleaning can.

If you want to pack a project in your extension, the easiest solution is to just execute the command:

await VS.Commands.ExecuteAsync("Build.Packselection");

reduckted avatar Apr 11 '22 11:04 reduckted

Thank you for the info and the quick help. I will try this out. Maybe this could be added to the help? I might also do this and create a PR, but it might take some time..

And as I want to learn something? Is this Build.Packselection somewhere documented? Or how could I have known that?

AchimStuy avatar Apr 12 '22 12:04 AchimStuy

Is this Build.Packselection somewhere documented? Or how could I have known that?

Since it's a command, you should be able to assign a shortcut key to it. So I went to Tools -> Options and then went to the Environment/Keyboard page. I searched for "pack".

image

To make sure that Build.Packselection was the correct command, I assigned a keyboard shortcut to it, then I checked if the shortcut appeared next to the menu item.

image

And it was the correct command. 🎉

reduckted avatar Apr 13 '22 10:04 reduckted