locked
Retrieve a tree of all exportable settings RRS feed

  • Question

  • Hi forum,

    I want to retrieve a full tree of all exportable settings available in the Tools -> Options dialog in VS. Until now, I use the following code:

    IVsProfileDataManager profileDataManager
    Package.GetGlobalService(typeof(SVsProfileDataManager))
    asIVsProfileDataManager; profileDataManager.GetSettingsForExport(out sets);

     

    After this two lines I iterate through all the settings of the first level, get the names, the child count and, if there are children, call the current method recursivly.

    In the build up tree I see some inconsistency. The "Fonts and Colors" section appears two times for example. Unter AutomationProperties -> Environment and General Settings.

    Is there an explanation for this? Can I somehow correct this inconsistency?

    Thx & bye

    Twainsoft



    The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3


    • Edited by Twainsoft Monday, February 20, 2012 9:46 PM Better code formatting.
    Monday, February 20, 2012 9:45 PM

Answers

  • Looks like I never posted a follow up on this. Apologies for that. I did get a bug filed on this, but it looks like it was postponed. For the time being the recommendation is to just ignore the duplicate entries. Not a great answer, but I'm guessing you've already implemented something along those lines.

    Sincerely,


    Ed Dore

    Friday, July 20, 2012 8:45 PM

All replies

  • Hi Twainsoft,

    Thank you for your question.

    I am trying to involve someone familiar with this topic to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.


    Lucy Liu [MSFT]
    MSDN Community Support | Feedback to us

    Friday, February 24, 2012 8:54 AM
  • I'm not really sure. The documentation around this interface is pretty sparse. According to the comments in the vsshell80.idl.

     //---------------------------------------------------------------------------
     // IVsProfileSettingsTree
     //---------------------------------------------------------------------------
     // Implemented by the IDE.
     // This is an internal interface used to allow communication between native and
     // managed code in the IDE.

    I presume that the various methods allow for manipulating/retrieving various settings for import/export purposes. If you call IVsProfileDataManager::ExportAllSettings and dump the entire tree to an XML file, do you see duplicate entries there as well?

    Sincerely,


    Ed Dore

    Friday, February 24, 2012 5:46 PM
  • Hi Ed Dore,

    sorry for my late reply.

    Thats the point! If I export the tree to an XML file, there are no duplicates. That was the reason for my initial post, because I can't explain the duplicates.

    Thx & bye,
    Twainsoft


    The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3

    Tuesday, February 28, 2012 9:49 PM
  • Can you post a code snippet that will repro the behavior? It's hard to guess based on just the description of the behavior observed.

    Thanks,


    Ed Dore

    Tuesday, February 28, 2012 10:44 PM
  • Hi Ed Dore,

    oh of course!

    IVsProfileSettingsTree sets;
    IVsProfileSettingsTree wl;
    IVsProfileDataManager profileDataManager = Package.GetGlobalService(typeof(SVsProfileDataManager)) as IVsProfileDataManager;
    profileDataManager.GetSettingsForExport(out sets);
     
    FillTree(sets);

    internalvoid FillTree(IVsProfileSettingsTree sets) {     TreeNode parent = newTreeNode("Root");     this.selectedSettingsOptions.Nodes.Add(parent);     this.AddNode(sets, parent);     parent.ExpandAll(); } privatevoid AddNode(IVsProfileSettingsTree sets, TreeNode parent) {     string displayName = "";     string pbstrRegisteredName = "";     sets.GetDisplayName(out displayName);     sets.GetRegisteredName(out pbstrRegisteredName);     int childCount = 0;     sets.GetChildCount(out childCount);     TreeNode newNode = newTreeNode(displayName + "(" + pbstrRegisteredName + ") (Children: " + childCount + ")");     parent.Nodes.Add(newNode);     for (int i = 0; i < childCount; i++)     {         IVsProfileSettingsTree childTree;         sets.GetChild(i, out childTree);         this.AddNode(childTree, newNode);     } }  

    I use this code to fill a Windows Forms TreeView. As you can see there, the "Fonts and Colors" entry for example appears under "General Settings\Fonts and Colors" and "Options\Environment\Fonts and Colors".

    Maybe this helps.

    Thx & bye,
    Twainsoft


    The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3

    Wednesday, February 29, 2012 8:48 AM
  • Hi forum,

    i found out, that the Property "RegisteredName" and the Package GUID are the same on both entries.

    I think, this is just a visual/display problem. Of course I am interested in any explanation for this issue :). But I think this is not so critical as I thought it would be, when I started this question.

    Bye,
    Twainsoft


    The Visual Studio Settings-Switcher! Visit http://visualstudiogallery.msdn.microsoft.com/a79072f7-3109-44a0-95c0-9c50e729d6a3

    • Marked as answer by Twainsoft Thursday, March 1, 2012 9:54 PM
    • Unmarked as answer by Twainsoft Thursday, March 1, 2012 9:54 PM
    Thursday, March 1, 2012 9:54 PM
  • Looks like I never posted a follow up on this. Apologies for that. I did get a bug filed on this, but it looks like it was postponed. For the time being the recommendation is to just ignore the duplicate entries. Not a great answer, but I'm guessing you've already implemented something along those lines.

    Sincerely,


    Ed Dore

    Friday, July 20, 2012 8:45 PM