{"id":1763,"date":"2010-09-08T11:10:00","date_gmt":"2010-09-08T11:10:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/visualstudio\/2010\/09\/08\/introducing-the-vspackage-builder\/"},"modified":"2022-05-23T01:10:12","modified_gmt":"2022-05-23T08:10:12","slug":"introducing-the-vspackage-builder","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/visualstudio\/introducing-the-vspackage-builder\/","title":{"rendered":"Introducing the VSPackage Builder"},"content":{"rendered":"<p>Last week we released the first version of a new project template, <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/e9f40a57-3c9a-4d61-b3ec-1640c59549b3\">VSPackage Builder<\/a>, which enables rapid development of the command UI and tool window infrastructure of VS 2010 extensions. VSPackage Builder requires VS 2010 Pro or above, and can be installed directly from within VS using the Extension Manager, or indirectly from the <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/e9f40a57-3c9a-4d61-b3ec-1640c59549b3\">Visual Studio Gallery<\/a>. Installation requires that the <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&amp;displaylang=en\">VS 2010 SDK<\/a> be already installed. <\/p>\n<h3>Key Features<\/h3>\n<p>To introduce some of the key features of the VSPackage Builder project template, let&rsquo;s use the template to create a new extension project that includes a WPF tool window with a toolbar, and command UI support to allow the tool window to be opened from the Tools menu and from a button on the Standard toolbar, and via a shortcut key. Time to complete this will be 5 minutes or less!<\/p>\n<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n<tbody>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>1. Start by creating a new project using the <b>VSPackage Builder<\/b> template, located under <b>Visual C# &gt; Extensibility<\/b> in the new project dialog &#8211; then add a command to the empty extension by dragging an <b>Add Command<\/b> quick start from the Toolbox onto the design surface. The result should be as shown.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/6138.clip_image00213_thumb_45C4EEAC-1.jpg\"><img decoding=\"async\" height=\"329\" width=\"403\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/6138.clip_image00213_thumb_45C4EEAC-1.jpg\" alt=\"clip_image002[13]\" border=\"0\" title=\"clip_image002[13]\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>2. Modify the command&rsquo;s <b>Button Text<\/b>, <b>Command Flags<\/b>, <b>Icon<\/b>, <b>Name<\/b>, <b>Priority<\/b> and <b>Shortcut Keys<\/b> properties by selecting &ldquo;Button1&rdquo; on the design surface and making the appropriate edits using the property browser, as shown.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/0755.clip_image004_thumb_34FD43FE-1.jpg\"><img decoding=\"async\" height=\"364\" width=\"265\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/0755.clip_image004_thumb_34FD43FE-1.jpg\" alt=\"clip_image004\" border=\"0\" title=\"clip_image004\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p>3. Change the command placement location by clicking on the <b>Location<\/b> property of the <b>External Group<\/b> instance, and choosing an alternate (<b>Tools Menu [Other 2]<\/b>). Note the long list of standard IDE locations that are available for selection.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/3404.clip_image006_thumb_39934EB8-1.jpg\"><img decoding=\"async\" height=\"330\" width=\"403\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/3404.clip_image006_thumb_39934EB8-1.jpg\" alt=\"clip_image006\" border=\"0\" title=\"clip_image006\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p>4. Add another placement for the command by dragging a <b>Group<\/b> from the <b>External UI<\/b> category in the Toolbox onto the design surface and updating the <b>Location<\/b> property as shown. Connect this new &ldquo;external group&rdquo; to the command using a <b>Connect<\/b> control from the toolbox.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/1447.clip_image008_thumb_2BE092B0-1.jpg\"><img decoding=\"async\" height=\"143\" width=\"304\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/1447.clip_image008_thumb_2BE092B0-1.jpg\" alt=\"clip_image008\" border=\"0\" title=\"clip_image008\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p>5. Now add a WPF-based toolwindow to the extension by dragging a <b>ToolWindow (WPF)<\/b> from the <b>Toolwindows<\/b> category in the toolbox onto the Toolwindow &ldquo;swimlane&rdquo; of the design surface. Connect the tool window to the command using a <b>Launch<\/b> connection, as shown. The Launch connection causes the tool window to be opened whenever the command is executed.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/3005.clip_image010_thumb_2D61AEC4-1.jpg\"><img decoding=\"async\" height=\"145\" width=\"398\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/3005.clip_image010_thumb_2D61AEC4-1.jpg\" alt=\"clip_image010\" border=\"0\" title=\"clip_image010\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p>6. Select the tool window instance on the design surface, and set the tool window properties as shown so that it will appear tabbed with the Solution Explorer when first opened.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/6153.clip_image012_thumb_58C5CFBE-1.jpg\"><img decoding=\"async\" height=\"369\" width=\"262\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/6153.clip_image012_thumb_58C5CFBE-1.jpg\" alt=\"clip_image012\" border=\"0\" title=\"clip_image012\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p>7. Now drag a <b>Toolwindow Toolbar<\/b>, <b>Group<\/b> and <b>Combo<\/b> from the toolbox onto the design surface and connect them and update their <b>Name<\/b> properties as shown. By connecting the tool window toolbar to the tool window, it will automatically be displayed whenever the tool window is visible.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/1351.clip_image014_thumb_5C83748E-1.jpg\"><img decoding=\"async\" height=\"220\" width=\"240\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/1351.clip_image014_thumb_5C83748E-1.jpg\" alt=\"clip_image014\" border=\"0\" title=\"clip_image014\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td width=\"231\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p>8. Save the solution, and press Ctrl-F5 to build and run the extension in the experimental instance. <\/p>\n<p>Press Ctrl-Alt-1 to open the tool window (shown). Note that the new command is available on the Standard toolbar and in the Tools menu as expected.<\/p>\n<\/td>\n<td width=\"406\" valign=\"top\">\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/5148.clip_image016_thumb_61197F48-1.jpg\"><img decoding=\"async\" height=\"238\" width=\"215\" src=\"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-content\/uploads\/sites\/4\/2010\/09\/5148.clip_image016_thumb_61197F48-1.jpg\" alt=\"clip_image016\" border=\"0\" title=\"clip_image016\" style=\"border-right-width: 0px;margin: 0px 0px 0px 30px;border-top-width: 0px;border-bottom-width: 0px;border-left-width: 0px\" \/><\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>More Information<\/h3>\n<p>Much more detail and two additional walkthroughs are included in the <a href=\"http:\/\/code.msdn.microsoft.com\/vspackagebuilder\/Release\/ProjectReleases.aspx\">VSPackage Builder readme<\/a>. We highly recommend that prospective extension developers at least browse through the readme before embarking on their own VSPackage Builder based projects.<\/p>\n<h3>Background<\/h3>\n<p>The <a href=\"http:\/\/www.microsoft.com\/downloads\/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&amp;displaylang=en\">VS 2010 SDK<\/a> includes the <b>Visual Studio Package<\/b> project template that has for several years been the on ramp for developers building <a href=\"http:\/\/msdn.microsoft.com\/en-us\/vstudio\/ff637679.aspx\">VSPackage<\/a>-based extensions. This template provides a solid extension starting point, however configuration changes such as adding and placing commands, must be handled through code changes in multiple files and involves a fairly steep learning curve. Feedback on this experience led to the definition of the key requirements for the VSPackage Builder project template, which included:<\/p>\n<ul>\n<li>Make it easy to change command UI and tool window infrastructure configuration <\/li>\n<li>Support rapid prototyping of command UI that can fully exploit the VS command UI features <\/li>\n<li>Help developers learn existing VS extension object models <\/li>\n<li>Restrict the volume and complexity of any generated code <\/li>\n<\/ul>\n<p>As implementation alternatives were explored, we quickly determined that the <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/bb126259.aspx\">domain-specific language<\/a> based design surface approach leveraged by <a href=\"http:\/\/visualstudiogallery.msdn.microsoft.com\/en-us\/396c5990-6356-41c0-aa20-af4c3e58c7ae\">Feature Builder Power Tool<\/a>, could also be effective in helping to meet VSPackage Builder requirements. An exploration project was initiated with our friends at <a href=\"http:\/\/www.clariusconsulting.net\/\">Clarius Consulting<\/a> doing much of the implementation heavy lifting, and the end result is VSPackage Builder v1.0 which is being made available for developers to try.<\/p>\n<h3>Sending Feedback<\/h3>\n<p>Your feedback on the general usefulness of the template, feature suggestions for v2, and bug reports is welcomed. Please send feedback directly to <a href=\"mailto:vspbfeed@microsoft.com?subject=VSPackage%20Builder%20feedback\">vspbfeed@microsoft.com<\/a>.<\/p>\n<p>James Bartlett, Senior Program Manager Lead, VS IDE Platform Team<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week we released the first version of a new project template, VSPackage Builder, which enables rapid development of the command UI and tool window infrastructure of VS 2010 extensions. VSPackage Builder requires VS 2010 Pro or above, and can be installed directly from within VS using the Extension Manager, or indirectly from the Visual [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":255385,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[155],"tags":[5],"class_list":["post-1763","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visual-studio","tag-csharp"],"acf":[],"blog_post_summary":"<p>Last week we released the first version of a new project template, VSPackage Builder, which enables rapid development of the command UI and tool window infrastructure of VS 2010 extensions. VSPackage Builder requires VS 2010 Pro or above, and can be installed directly from within VS using the Extension Manager, or indirectly from the Visual [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/1763","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/comments?post=1763"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/posts\/1763\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media\/255385"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/media?parent=1763"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/categories?post=1763"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/visualstudio\/wp-json\/wp\/v2\/tags?post=1763"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}