locked
Set default placement of custom toolbar RRS feed

  • Question

  • Hi,

    How would I (preferrably in .vsct, but any way would do), specify the default positioning of a custom toolbar?  I would like my custom toolbar to appear immediately to the right of the standard toolbar.  Right now, my custom toolbar's default position is below the standard toolbar, rather than to the right on the same line.

    Thanks,

    Notre

    Thursday, February 24, 2011 10:10 PM

Answers

  • Yes, if the standard toolbar is hidden (you can't remove it in the sense of deleting it as it is a 'built in' toolbar, but you can hide it via DTE) then, although all other toolbars will still be in row N (where N > 0), since there is nothing in row 0 they will 'collapse' upward and for all intents and purposes appear to be in row 0.  If the standard toolbar came back (like the user showed it or you made it visible again via DTE) then it would push them all back down (since they REALLY) are in row 1,2,3, etc... and only appear to be in row 0 as row 0 has no visible items.

    As for resetting you can use Tools->Import and Export Settings ->Reset Settings.

    Ryan

    • Marked as answer by Notre Friday, February 25, 2011 12:19 AM
    Thursday, February 24, 2011 11:37 PM

All replies

  • The row that contains the standard toolbar is special, we don't allow any other toolbars on that row. Normally you can indicate what row you want to be on using the hi-word of your toolbar's priority, below is the code from the product that extracts the data along with a comment explaining a little bit about it:

    // Toolbars can specify row offset in their (otherwise unused) priority field.
    // Check for non-zero offset value now.  This value moves them some offset from
    // default position, which is row 1 (for non-toolwindow toolbars), which is the
    // row immediately below the std toolbar.
    const int iRowOffset = ((HIWORD(data.Priority)) & 0xF);
    if(iRowOffset)
    {
        *pdwDesiredSlot += (iRowOffset);
    }


    Ryan

    Thursday, February 24, 2011 10:54 PM
  • Not to shoot the messenger, but -- really?  That's really too bad. 

    Some of the other toolbars, other than Standard appear on the first row, and I never moved them, so is it just for 'custom' toolbars (non-MS) toolbars that this restriction exists?  The user can move my custom toolbar right alongside the Standard toolbar, and VS will remember the position...

    Notre

    Thursday, February 24, 2011 10:59 PM
  • What other toolbars?  As far as I know NO other toolbars can, we don't differentiate between 'internal' and 'external' toolbars.  Profiles may do something here, if you move a toolbar into row 0 (the row of the std toolbar) we create a record that records that 'customization' (which is why VS remembers between sessions). If you then exported those records and used it as your profile (like the various profiles you choose from on first launch) then we would treat the toolbar placement as having been a customization (i.e. NOT coming from the command authoring) and we would simply place it wherever it told us to.

    You can set up a profile for your isolated shell app that does just that, I think if you only have one .vssettings file in the profiles directory we won't even ask if you want to use that one on startup the first time, we will just use it (you may need to call it General.vessettings as well...not sure, I can ask around if you need help getting it to work).

    Ryan

    Thursday, February 24, 2011 11:07 PM
  • Ok, I stand corrected re: other toolbars on the same row as the standard toolbar.  I glanced at the top row and it looks so long (when not customized) that I just incorrectly assumed there was multiple toolbars there when in fact only the standard toolbar is there.

    I see what you're saying re: profiles and customization.  Would another approach be to remove the Standard toolbar altogether (presumably via the DTE), create my own 'standard' toolbar with the same commands (or at least those I want), give it a low priority, and then create more custom toolbars with higher priority?  By removing the Standard toolbar, would the custom toolbars shift up (as there's now blank space)?

    Which leads to another question - given that I've customized my custom toolbar placement, how do I get it back to 'factory' default settings - Tools/Import and Export Settings...? 

    Thanks,

    Notre

    Thursday, February 24, 2011 11:19 PM
  • Yes, if the standard toolbar is hidden (you can't remove it in the sense of deleting it as it is a 'built in' toolbar, but you can hide it via DTE) then, although all other toolbars will still be in row N (where N > 0), since there is nothing in row 0 they will 'collapse' upward and for all intents and purposes appear to be in row 0.  If the standard toolbar came back (like the user showed it or you made it visible again via DTE) then it would push them all back down (since they REALLY) are in row 1,2,3, etc... and only appear to be in row 0 as row 0 has no visible items.

    As for resetting you can use Tools->Import and Export Settings ->Reset Settings.

    Ryan

    • Marked as answer by Notre Friday, February 25, 2011 12:19 AM
    Thursday, February 24, 2011 11:37 PM
  • You could also hide the standard toolbar via a profile, in fact if you are doing lots of toolbar fiddling it may be easier to set yourself up a 'stock' profile for your isolated app that does a bunch of the common stuff. It can move commands around, add commands to various locations, delete commands, show/hide toolbars, etc... Then you don't have to do it at runtime via DTE.

    Ryan

    Thursday, February 24, 2011 11:39 PM
  • Right now I'm using multiple .vsct files, .pkgundef, .pkgdef files, multiple IOLECommandTarget / menu command service, a priority command target package, and at last resort the DTE, so I've been reluctant to start adding profiles into the mix too :)

    Notre

    Friday, February 25, 2011 12:18 AM
  • Yes, I can understand that :)  Like I said, some of that may be able to be lessened with a custom profile, i.e. if you want to forever remove some commands you can do that via profile instead of at runtime via IOleCommandTargets. I don't think it is terribly hard to set up, basically you launch your shell and use the Tools->Customize to add/remove/rename/etc... and when you are done you just Export Settings and use that .vssettings as your profile, that will make the shell do the work of add/remove/rename instead of you having to do it, though it only works for statically authored (VSCT) commands, if you are creating dynamic commands at runtime via DTE you can't customize those via a profile.

    Ryan

    Friday, February 25, 2011 12:35 AM
  • Ok, I'll keep it in mind for the future.  I've got all my DTE stuff in a single function, so if it looks like that function is growing long, then I may switch to the profile route.  As for now, the DTE is doing the job, albiet slower than profiles and some other options.

    Thanks again,

    Notre

    Friday, February 25, 2011 12:38 AM
  • I'm having a bit of problem with my strategy of trying to use the DTE and my own custom 'standard' toolbar.  At present, I have three packages.  One package acts as the priority command target and is loaded when my VS isolated shell app starts.  This package provides my main custom 'standard' toolbar.  The toolbar definition looks like this:

       <Menu guid="guidVSShellCommandHandlerHelperCmdSet" id="MainStandardToolbar" type="Toolbar" toolbarPriorityInBand="0x0100">
        <CommandFlag>DefaultDocked</CommandFlag>
        <CommandFlag>AlwaysCreate</CommandFlag>
        <Strings>
         <ButtonText>Main Standard</ButtonText>
         <CommandName>Main Standard</CommandName>
        </Strings>
       </Menu>
    

    My second package offers an editor and menu stuff, including its own 'standard' toolbar:

      <Menu guid="guidVSDesignersCmdSet" id="SecondStandardToolbar" type="Toolbar" toolbarPriorityInBand="0x0200">
        <CommandFlag>DefaultDocked</CommandFlag>
        <Strings>
         <ButtonText>Second Standard</ButtonText>
         <CommandName>Second Standard</CommandName>
        </Strings>
       </Menu>
      </Menus>
    

    My third package offers a different editor and menu stuff, including its own 'standard' toolbar and a layout toolbar:

       <Menu guid="guidWorkflowVSDesignerCmdSet" id="WorkflowStandardToolbar" type="Toolbar" toolbarPriorityInBand="0x0200">
        <CommandFlag>DefaultDocked</CommandFlag>
        <Strings>
         <ButtonText>Workflow Standard</ButtonText>
         <CommandName>Workflow Standard</CommandName>
        </Strings>
       </Menu>
       
       <Menu guid="guidWorkflowVSDesignerCmdSet" id="WorkflowLayoutToolbar" type="Toolbar" toolbarPriorityInBand="0x0300">
        <CommandFlag>DefaultDocked</CommandFlag>
        <Strings>
         <ButtonText>Workflow Layout</ButtonText>
         <CommandName>Workflow Layout</CommandName>
        </Strings>
       </Menu>
    

    As you can see, the first 'main' standard custom toolbar is set to AlwaysCreate.  The other 3 toolbars (between the two packages) are controlled by two different custom UI contexts (one each for the second and third package).

    I'm having two problems:

    1. Although I set the first 'main' standard custom toolbar to AlwaysCreate (not otherwise controlled by a UI context), I don't visibly see the toolbar unless I manually make it visible in the IDE's Customize dialog. 

    2. After making the 'main' standard custom toolbar visible via the IDE UI, when the editor from the second package is active (the one with only a single 'standard' toolbar), then things work as I'd hope - the 'main' standard custom toolbar appears in the first (visible) row and the second 'standard' toolbar appears to the right.  This is good.  The problem is with the 3rd package's two custom toolbars and the 'main' standard custom toolbar.  When the context from the 3rd package is active, its two custom toolbars are shown (good) and the 'main' standard custom toolbar is shown, however, the 'main' standard custom toolbar appears below the other two custom toolbars.  I thought based on the toolbarPriorityInBand, it would appear to the right...

    Any ideas?

    Thanks,

    Notre

    Friday, February 25, 2011 6:56 PM
  • 1:  AlwaysCreate is not what you think, in fact we completely ignore it in 2010.  Specifically AlwaysCreate is documented as doing the following:

                 "Menu is created even it has no groups or buttons."

    that doesn't make a toolbar 'default' visible, it has to do with whether we create a menu node for a menu that has no children.


    2:  DefaultDocked is unecessary in 2010 and beyond as we don't have floating toolbars, so specifying it is both unecessary and pointless (though it doesn't negatively effect anything).

     This is another scenario where you likely have to use a profile to do what you want.  By default the only toolbar that is 'default' visible in the shell is the standard toolbar.

    This doesn't work terribly well for an ISO shell scenario that doesn't want to use the standard toolbar, but it is the case and has been the case forever (long before we ever supported an isolated shell scenario). All toolbars other than the standard toolbar that show up 'by default' are doing so via a profile.

    It isn't clear if we can change this behavior without it breaking existing users as all existing toolbars expect to not be shown on startup, and it isn't clear if there is a clean way for msenv.dll (the dll that contains the code that builds the command UI) to know if it is running in an isolated shell scenario (it is included in every VS SKU) and possibly choose a different behavior, and what that behavior would be (are all toolbars default visible? If so how does one say they don't want to be visible?)

    The ordering thing is odd, from a quick glance it looks like what you have is correct, we won't guarantee any sort of ordering between the two items that have the same priority (0x0200), but we should guarantee the appear to the right of 0x0100 and the left of 0x0300.

    Can you look at your CTM file via VSCTPowerToy and look what the priority of the various toolbars in question are encoded as in the CTM?

    Ryan

    Friday, February 25, 2011 9:21 PM
  • Thanks for the info re: AlwaysCreate and DefaultDocked.  I guess I should read the docs closer!

    Still being recluctant to use a profile (maybe uncessarily :), would another way of making a toolbar visible by default make it so that it respects 2 UI context - UICONTEXT_SolutionExists and UICONTEXT_NoSolution via a couple of VisbilityItem elements?

    The two toolbar items that have the same priority don't show up at the same time, based on different UI contexts.

    I couldn't find any CTM files.  I have a CTO file, would that do?

    Notre

    Friday, February 25, 2011 9:44 PM
  • I tried doing the UI context thing as describe above but it didn't work :(  I also tried using the DTE to make the toolbar visible, and while it didn't throw any exceptions, the toolbar is not visible either. 

    For my other toolbars, they respect custom UI contexts and show up... why won't this one?  Also, I can hide the 'real' Standard toolbar via the DTE, but I can't make my 'main' custom one visible via the DTE...

    Notre

    Friday, February 25, 2011 10:20 PM
  • I also tried using Import and Export Settings/Reset all Settings, Window/Reset Window Layout and deleting everything in the appropriate subfolder of %localappdata%.

    While I couldn't find the CTM, I did look at the 3 different CTO files, and the priority matches what I put in the .vsct files.

    Still no luck in getting my 'main' custom 'standard' toolbar to appear in the desired position, for the one editor

    Notre

    Friday, February 25, 2011 10:45 PM
  • The CTM is a hidden file under your users subdir (sorry, forgot to mention that :)).  Finding it on my box generally involves something as shown below

    c:\Users\rmolden>dir /A:H /S *.CTM
     Volume in drive C is 0x1
     Volume Serial Number is 24B6-53FF

     Directory of c:\Users\rmolden\AppData\Local\Microsoft\VisualStudio\11.0\1033

    02/24/2011  03:43 PM           751,107 devenv.CTM
                   1 File(s)        751,107 bytes

         Total Files Listed:
                   1 File(s)      751,107 bytes
                   0 Dir(s)  83,732,172,800 bytes free

    After locating it, to make it loadable in VSCTPowerToy, you need to make it unhidden, attrib -h will do that.

    >would another way of making a toolbar visible by default make it so that it respects 2 UI context - UICONTEXT_SolutionExists and UICONTEXT_NoSolution via a couple of VisbilityItem elements?

    Yes, that is a common way people use to make their toolbars 'always visible'. 

    After making these setup changes have you re-run /setup?  Or alternatively simply deleted the CTM file above (if it is missing on startup VS will rebuild it, that involves processing all menu contributions from all dlls)?

    Ryan

    Friday, February 25, 2011 11:12 PM
  • Thanks - now I can find the CTM file and can view it under VSCTPowerToy.  I looked at all the Menus and there are a number of Toolbars, but only the 4 I expect from my 3 packages.  Their priority matches what I described above.

    As for the UI Context stuff, I also tried adding another custom UI context (instead of the two solution UI contexts) and setting this context during initialization of my package - but no automatic showing of the custom 'main' toolbar, after I uncheck it from Customize UI. (And then resetting of import/export settings, deleting %appdata% and reseting window layout).

    Yes, I did run with /setup.  And I did a full rebuild (instead of just build) of my solution beause I was seeing some issues if I just did a incremental build.

    Notre

    Friday, February 25, 2011 11:38 PM
  • >but no automatic showing of the custom 'main' toolbar, after I uncheck it from Customize UI.

    Okay, I am confused. When you explicitly change the visibility via the customize UI or the right click toolbar context menu that overrides auto-visibility. Also the positioning and not showing up with UI contexts are two unrelated issues, so it is confusing to try and address them both at once, we should hold one steady and work on the other as to avoid changing too much at once and not understanding what is happening.

    Can you try the following.

    1:  Load your application, run Import & Export Settings -> Reset Settings to clear all 'customizations'

    2:  Close VS

    3:  Delete your CTM file

    4:  Re-launch VS

    and tell me if your 'doesn't appear with the UI context issue' goes away?  I suspect you have something in a wacky state due to previous manual intervention, that thwarts auto-visibility, by design.

    Ryan

    Friday, February 25, 2011 11:47 PM
  • Fair enough re: proceeeding with one issue at a time.

    I followed the four steps you outlined, but my 'doesn't appear with UI context issue' persists.  Here's how my VisibilityConstraints looks:

     <VisibilityConstraints>
      <VisibilityItem guid="guidVSShellCommandHandlerHelperCmdSet" id="MainStandardToolbar" context="UICONTEXT_SolutionExists" />
      <VisibilityItem guid="guidVSShellCommandHandlerHelperCmdSet" id="MainStandardToolbar" context="UICONTEXT_NoSolution" />
     </VisibilityConstraints>
    

    I also tried it with my custom UI context as the VisibilityItem's context (now commented out) but that didn't work either.

    Notre

     

    Friday, February 25, 2011 11:55 PM
  • And you aren't doing anything with DTE at launch/run time to muck with any command bars (or at least this specific one)?

    What you show is a VERY common pattern that lots and lots of people use to make their toolbars always visible. Can you test that the UI contexts are in fact active?  By inserting some code that will call GetCmdUICtxtCookie for each and then calling IsCmdUICtxtActive on each?

    Also can you look up the Visibilities in VSCTPowerToy and ensure your toolbars are associated with them?

    Ryan

    Saturday, February 26, 2011 12:07 AM
  • Yep, I am doing something with the DTE with command bars, but not this one.

    Yeah, I know using the solution UI context is a common pattern - in fact, on your advice, I'm using it in this same package, to force the package itself to load (and it works great):

      [ProvideAutoLoad("f1536ef8-92ec-443c-9ed7-fdadf150da82")] //UICONTEXT_SolutionExists
      [ProvideAutoLoad("adfc4e64-0397-11d1-9f4e-00a0c911004f")] //UICONTEXT_NoSolution
    

    I suspect the contexts must be active, otherwise my package wouldn't load, AFAIK.  But, I can code it - where should I put those calls in Initialize of the package?

    Notre

    Saturday, February 26, 2011 12:13 AM
  • Anywhere that the code will run at a time you expect them to be set, so in your package's intiialize should be fine, and if it is causing AutoLoading it does sound like they are set.

    I am somewhat baffled by why they wouldn't be made visible.  Can you do Tools->Import & Export Settings, choose to export just your General -> Menu and CommandBar Customizations and paste the exported .vssettings file here?  It should be really small if all you export is your Menu and CommandBar Customizations (click on that root node to uncheck everything else, then just explicitly check the Menu and CommandBar Customizations node).

    Ryan

    Saturday, February 26, 2011 12:21 AM
  • I'm confused too :)  I put the code in Initialize, and it gave the expected results.

    Here's my customizations to Menu and CommandBars:

    <UserSettings>
    	<ApplicationIdentity version="10.0"/>
    	<ToolsOptions/>
    	<Category name="Environment_Group" RegisteredName="Environment_Group">
    		<Category name="Environment_CommandBars" Category="{B9D9C123-B500-4202-B887-57C829CBD08F}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_CommandBars" PackageName="Visual Studio Environment Package">
    			<CommandBars Version="05072811">
    				<DefaultCustomizations/>
    				<UserCustomizations>
    					<modify_toolbar Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001" Visibility="hide" FullScreen="hide" Dock="top" Row="1"/>
    					<modify_toolbar Menu="{D7E8C5E1-BDB8-11D0-9C88-0000F8040A53}:00000010" Visibility="auto" FullScreen="hide" Dock="top" Row="2" FloatRectangle="0,0,755,24" DockRectangle="7,0,755,24"/>
    					<modify_toolbar Menu="{74D21312-2AEE-11D1-8BFB-00A0C90F26F7}:00000601" Visibility="auto" FullScreen="hide" Dock="top" Row="2" FloatRectangle="0,0,607,24" DockRectangle="10,0,607,24"/>
    					<modify_toolbar Menu="{9A0F15C1-3E39-40C7-A6B2-B33F6AD15E43}:00001000" Visibility="hide" FullScreen="hide" Dock="top" Row="2"/>
    					<modify_toolbar Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000" Visibility="auto" FullScreen="hide" Dock="top" Row="1" FloatRectangle="0,0,118,24" DockRectangle="2,0,118,24"/>
    					<modify_toolbar Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00002000" Visibility="auto" FullScreen="hide" Dock="top" Row="1" FloatRectangle="0,0,198,24" DockRectangle="1,0,198,24"/>
    					<add Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000151" CmdPri="00800001" Group="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002200" GroupPri="02000000" Menu="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002000"/>
    					<add Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000007" CmdPri="00508001" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001050" GroupPri="00000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<add Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000102" CmdPri="00804001" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<add Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000103" CmdPri="01008001" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:000000de" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000171" GroupPri="01000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000014b" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000171" GroupPri="01000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:000000e0" CmdPri="05000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000171" GroupPri="01000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000010" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000172" GroupPri="03000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000000f" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000172" GroupPri="03000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000001a" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000172" GroupPri="03000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000002c" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000173" GroupPri="05000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000001e" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000173" GroupPri="05000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000127" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000174" GroupPri="09000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000151" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000177" GroupPri="0b000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:000000eb" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000178" GroupPri="0d000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000002a" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000178" GroupPri="0d000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000502" CmdPri="ff000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000178" GroupPri="0d000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{2A8866DC-7BDE-4DC8-A360-A60679534384}:00000100" CmdPri="01500000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:0000012d" GroupPri="a0000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000081"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000424" CmdPri="0f000000" Group="{C9DD4A58-47FB-11D2-83E7-00C04F9902C1}:0000011d" GroupPri="0f000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000085"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000108" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:0000015a" GroupPri="ffff0000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000085"/>
    					<remove Cmd="{C9DD4A59-47FB-11D2-83E7-00C04F9902C1}:00000173" CmdPri="20000000" Group="{C9DD4A58-47FB-11D2-83E7-00C04F9902C1}:00000163" GroupPri="ff000000" Menu="{C9DD4A58-47FB-11D2-83E7-00C04F9902C1}:00000401"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000151" CmdPri="00500000" Group="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002200" GroupPri="02000000" Menu="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002000"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000007" CmdPri="01000000" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001050" GroupPri="00000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<remove Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000102" CmdPri="01000000" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<remove Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000103" CmdPri="01000000" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    				</UserCustomizations>
    			</CommandBars>
    			<PropertyValue name="ShowLargeButtons">false</PropertyValue>
    			<PropertyValue name="ShowScreenTips">true</PropertyValue>
    			<PropertyValue name="ShowScreenTipShortcutKeys">false</PropertyValue>
    		</Category>
    	</Category>
    </UserSettings>
    
    

     

    Notre

     

    Saturday, February 26, 2011 12:28 AM
  • And what is the GUID behind 'guidVSShellCommandHandlerHelperCmdSet'?  And the ID behind 'MainStandardToolbar'?

    Ryan

    Saturday, February 26, 2011 12:31 AM
  • <GuidSymbol name="guidVSShellCommandHandlerHelperCmdSet" value="{9a0f15c1-3e39-40c7-a6b2-b33f6ad15e43}">

    <IDSymbol name="MainStandardToolbar" value="0x1000"/>

    FYI, I commented out the DTE code, re-ran everything, but no luck.

    Notre

    Saturday, February 26, 2011 12:34 AM
  • And you did a reset settings? Something is wrong becuase you have an explicit 'hide' record in your user customizations which is overriding the UI context visibility, specifically

    <modify_toolbar Menu="{9A0F15C1-3E39-40C7-A6B2-B33F6AD15E43}:00001000" Visibility="hide" FullScreen="hide" Dock="top" Row="2"/>

    THe only way I know if for you to have such a record is

    1:  You hid the toolbar via DTE.

    2:  You hid the toolbar via the Tools->Customize dialog.

    3:  You hid the toolbar by right clicking on the toolbar tray and unchecking its associated menu item.

    Reset Settings should have cleared ALL of this out, if you are mucking with toolbars via DTE on startup it would cause some of the volume I see in your above settings (lots of command removals), but other than that I can't explain why after a Reset you would still have a record like this in your User Customizations section.

    Ryan

    Saturday, February 26, 2011 12:39 AM
  • Yeah, I see that record too.  I definitely did hide the toolbar via Tools->Customize dialog (scenario 2), because that dialog is how I got it to show up.  But, I did Reset Settings many times since hiding it.

    Notre

    Saturday, February 26, 2011 12:51 AM
  • Well, this explain why it isn't working with UI context as we view it as explicitly hidden by the user and thus that overrides any UI context visibility. I don't understand how it could be there after reset settings.  Can you run Reset Settings and immediately afterwards do another Export of the command bar stuff (without even shutting down VS)?

    Ryan

    Saturday, February 26, 2011 12:56 AM
  • Here it is:

    <UserSettings>
    	<ApplicationIdentity version="10.0"/>
    	<ToolsOptions/>
    	<Category name="Environment_Group" RegisteredName="Environment_Group">
    		<Category name="Environment_CommandBars" Category="{B9D9C123-B500-4202-B887-57C829CBD08F}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_CommandBars" PackageName="Visual Studio Environment Package">
    			<CommandBars Version="05072811">
    				<DefaultCustomizations/>
    				<UserCustomizations>
    					<modify_toolbar Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001" Visibility="hide" FullScreen="hide" Dock="top" Row="1"/>
    					<modify_toolbar Menu="{D7E8C5E1-BDB8-11D0-9C88-0000F8040A53}:00000010" Visibility="auto" FullScreen="hide" Dock="top" Row="2" FloatRectangle="0,0,755,24" DockRectangle="7,0,755,24"/>
    					<modify_toolbar Menu="{74D21312-2AEE-11D1-8BFB-00A0C90F26F7}:00000601" Visibility="auto" FullScreen="hide" Dock="top" Row="2" FloatRectangle="0,0,607,24" DockRectangle="10,0,607,24"/>
    					<modify_toolbar Menu="{9A0F15C1-3E39-40C7-A6B2-B33F6AD15E43}:00001000" Visibility="hide" FullScreen="hide" Dock="top" Row="2"/>
    					<modify_toolbar Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000" Visibility="auto" FullScreen="hide" Dock="top" Row="1" FloatRectangle="0,0,118,24" DockRectangle="2,0,118,24"/>
    					<modify_toolbar Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00002000" Visibility="auto" FullScreen="hide" Dock="top" Row="1" FloatRectangle="0,0,198,24" DockRectangle="1,0,198,24"/>
    					<add Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000151" CmdPri="00800001" Group="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002200" GroupPri="02000000" Menu="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002000"/>
    					<add Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000007" CmdPri="00508001" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001050" GroupPri="00000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<add Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000102" CmdPri="00804001" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<add Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000103" CmdPri="01008001" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:000000de" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000171" GroupPri="01000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000014b" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000171" GroupPri="01000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:000000e0" CmdPri="05000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000171" GroupPri="01000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000010" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000172" GroupPri="03000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000000f" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000172" GroupPri="03000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000001a" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000172" GroupPri="03000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000002c" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000173" GroupPri="05000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000001e" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000173" GroupPri="05000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000127" CmdPri="01000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000174" GroupPri="09000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000151" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000177" GroupPri="0b000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:000000eb" CmdPri="02000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000178" GroupPri="0d000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:0000002a" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000178" GroupPri="0d000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000502" CmdPri="ff000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000178" GroupPri="0d000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000001"/>
    					<remove Cmd="{2A8866DC-7BDE-4DC8-A360-A60679534384}:00000100" CmdPri="01500000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:0000012d" GroupPri="a0000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000081"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000424" CmdPri="0f000000" Group="{C9DD4A58-47FB-11D2-83E7-00C04F9902C1}:0000011d" GroupPri="0f000000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000085"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000108" CmdPri="03000000" Group="{D309F791-903F-11D0-9EFC-00A0C911004F}:0000015a" GroupPri="ffff0000" Menu="{D309F791-903F-11D0-9EFC-00A0C911004F}:00000085"/>
    					<remove Cmd="{C9DD4A59-47FB-11D2-83E7-00C04F9902C1}:00000173" CmdPri="20000000" Group="{C9DD4A58-47FB-11D2-83E7-00C04F9902C1}:00000163" GroupPri="ff000000" Menu="{C9DD4A58-47FB-11D2-83E7-00C04F9902C1}:00000401"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000151" CmdPri="00500000" Group="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002200" GroupPri="02000000" Menu="{41C6F3FA-7D71-455A-B7E4-A728A7800804}:00002000"/>
    					<remove Cmd="{5EFC7975-14BC-11CF-9B2B-00AA00573819}:00000007" CmdPri="01000000" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001050" GroupPri="00000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<remove Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000102" CmdPri="01000000" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    					<remove Cmd="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00000103" CmdPri="01000000" Group="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001100" GroupPri="01000000" Menu="{468DA044-6CA5-46C3-AAA2-49291DB33D73}:00001000"/>
    				</UserCustomizations>
    			</CommandBars>
    			<PropertyValue name="ShowLargeButtons">false</PropertyValue>
    			<PropertyValue name="ShowScreenTips">true</PropertyValue>
    			<PropertyValue name="ShowScreenTipShortcutKeys">false</PropertyValue>
    		</Category>
    	</Category>
    </UserSettings>
    
    

    I see it resets to General.vssettings.  Searching my computer, I find multiple instances of that file...

     

    Notre

    Saturday, February 26, 2011 1:02 AM
  • Even after reset your custom toolbar is marked as hidden.  General.vssettings should not contain any UserCustomization section entries.  Can you use a tool like ProcessMonitor from SysInternals to see after you hit Reset what General.vssettings file it is reading in from (since you find multiple on your computer)? 

    That UserCustomization section should be empty except for things you have either explicitly done through the UI or through DTE, resetting should DEFINETLY empty it out. After a reset you may see items in the DefaultCustomizations section (which is empty above) but you should see NOTHING in the UserCustomizations. And you aren't doing anything special in your isolated shell around the reset settings command?

    Ryan

    Saturday, February 26, 2011 2:05 AM
  • I used Process Monitor and filtered on my isolated shell app process and file system activity.  I found a path to a General.vssettings file.  Here's  a strange thing - I cleared the Process Monitor log just before clicking the Finish button on the dialog after selecting reset option in my isolated shell app.  After clicking Finish,  I see a CreateFile operation on General.vssettings! I assume that means the file is being created - why would that be?

    Even if did something with the DTE (which I did at one point), presumbably those should be cleared out on reset, especially since I haven't restarted the process?

    The only thing I was previously doing in my isolated shell app around reset settings command was disabling the command altogether via the .pkgundef file.  I re-enabled that option, to try to go back to 'factory settings'.

    Thanks,

    Notre

    Monday, February 28, 2011 5:54 PM
  • The content of the General.vssettings file noted by Process Monitor is really short -

    <?xml version="1.0" encoding="us-ascii"?>
    <UserSettings>
      <ApplicationIdentity version="10.0"/>
    </UserSettings>

    The file size of all the various General.vssettings is the same as this one (117 bytes), except where I have VS 2010 installed where the file is much bigger.

    Notre

    Monday, February 28, 2011 6:13 PM
  • This is all very odd, do you have a repro of this you could give me?  The General.vssettings that is being created may be fine (if it can't find one it may create an empty one, which is what you have above). The fact that AFTER a reset your export is STILL showing all of those customizations is broken, those should ALL be thrown away by a reset, I can't imagine why they wouldn't be.

    Ryan

    Monday, February 28, 2011 6:50 PM
  • I know this is strange.  Before I try to prepare a repro for you (honestly, not sure how I will do that), is there any way I can skip all custom package loading & verify the problem persists? 

    Notre

    Monday, February 28, 2011 7:39 PM
  • By the way, the CreateFile thing may be a red herring - the docs (http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx) descibe this function as create or open a file or I/O device.  So maybe, VS is just opening the General.vssettings in a writable fashion...

    Notre

    Monday, February 28, 2011 7:41 PM
  • As for creating a repro I figured you could just package up your bits and send me a zip file (I don't need your sources or pdbs, simply I want to attach to the product and debug through our code to understand why it isn't throwing away the user customizations on reset, which is something I have never seen and can't explain).  As for disabling packages, I don't believe there is an easy way to do that, you could unregister the packages from the registry, but that isn't as easy as 'flipping a switch', the main problem is we (the VS shell) don't differentiate between 'custom packages' and 'normal packages', all of VS (both internal and external contributions) are treated the same by the shell and we can't differentiate one from another.

    Ryan

    Monday, February 28, 2011 7:44 PM
  • Ok, I'll see what I can do about providing you a repro.  What email address should I send it to?

    Notre

    Monday, February 28, 2011 7:48 PM
  • rmolden AT microsoft DOT com

    Ryan

    Monday, February 28, 2011 7:51 PM
  • Ok, I've sent you an email from notre_poubelle AT yahoo DOT com.  Please let me know if you have any problems receiving the email, or running the isolated shell application.

    Thanks,

    Notre

    Monday, February 28, 2011 8:16 PM
  • Okay, I think I see what is happening, I already e-mailed you privately but I will post here as well for the sake of the internet memory machine.

    Since your General.vssettings has no information for command bars we apparently don't ever trigger the 'reset' of command bars (as we have no 'base state' to roll back to).  Try adding this to your General.vssettings file inside the <UserSettings> tag, right below the ApplicationIdentity tag (but not as a child of the ApplicationIdentity tag).

    <Category name="Environment_Group" RegisteredName="Environment_Group">
        <Category name="Environment_CommandBars" Category="{B9D9C123-B500-4202-B887-57C829CBD08F}" Package="{DA9FB551-C724-11d0-AE1F-00A0C90FFFC3}" RegisteredName="Environment_CommandBars" PackageName="Visual Studio Environment Package">
          <CommandBars Version="05072811">
            <DefaultCustomizations/>
            <UserCustomizations/>
          </CommandBars>
          <PropertyValue name="ShowLargeButtons">false</PropertyValue>
          <PropertyValue name="ShowScreenTips">true</PropertyValue>
          <PropertyValue name="ShowScreenTipShortcutKeys">false</PropertyValue>
        </Category>
      </Category>

    It is simply an 'empty' base state (no profile or user customizations).  Then reset settings will apply that state on reset, as opposed to what it is doing now, which is nothing. After doing that when you do a Reset it should roll back to the initial (no modifications) state, or whatever state is described in the settings file.

    Ryan

    Monday, February 28, 2011 9:15 PM
  • Yep, that did it!  I never edited the General.vssettings file before. In fact, looking at a vanilla isolated shell project code generated by VS, I see exactly the same contents in the General.vssettings file.  To me, this looks like a bug in the wizard generated isolated shell generated code.  If you agree, I trust you'll report it?

    Doing the reset (now that my General.vssettings file does something useful) cleared up both the invisible toolbar problem and also the second problem - the custom toolbar appearing on a second line.  Hurray!

    Notre

     

    Monday, February 28, 2011 9:39 PM
  • Yes, I will file a bug, also yes there was a modify_toolbar record that was placing it on row 2 if you look above, so that was overriding the VSCT stuff as we viewed it as a user choice (which has higher precedence than the command authoring).

    Ryan

    Monday, February 28, 2011 9:44 PM
  • Yeah, I noticed the modify_toolbar record placing it on the second row, so I was hoping that was the root of the problem.

    The only mystery left for me is that at one point I tried to make my command bar visible via the DTE (as UI context wasn't doing it because of the change I made in the IDE).  I would've thought that my DTE change to make the toolbar visible would've worked, although I'm happy to leave that as an unsolved mystery :)

    Thanks again,

    Notre

    Monday, February 28, 2011 9:51 PM
  • User choices (which are represented by the records you see in the export sectiosn above) override all programmatic / command authoring choices.  Imagine how annoying it would be as a user if you explicitly hid a toolbar and it kept coming back because some code kept making it visible again?

    Ryan

    Monday, February 28, 2011 10:03 PM
  • Interesting - if I make a user choice to show a particular toolbar, I can still use the DTE to hide it.

    Notre

    Monday, February 28, 2011 11:55 PM
  • I wouldn't expect that, but it is possible :)  I would have to check the code again (haven't looked at it in quite awhile).  So you use DTE to hide it but not show it?  That seems odd.

    Ryan

    Tuesday, March 1, 2011 12:18 AM
  • Yeah, I use the DTE to hide the Standard toolbar.  I don't want it to ever be shown, to workaround the issue where we can't place any custom toolbars on the same row as the Standard toolbar.  I create my own 'standard' toolbar and show it sucesssfully through the UI context, thanks to your help.  I tried to show it via the DTE at point (before getting the UI context to work), but that didn't work.

    Notre

    Tuesday, March 1, 2011 12:30 AM