locked
Save/Load Settings to/from the XML storage in a VSPackage RRS feed

  • Question

  • Hello,

    im trying to create a custom DialogPage which can save and load the user settings in the Visual Studio XML storage. I created a CustomControl, DialogPage and registered it with ProvideOptionPage at the VSPackage class. Everything seems to work. The page is displayed in the VS options dialog.

    Then I added the ProvideProfileAttribute attribute, so the SaveSettingsToXml method in my derived DialogPage class is called properly and my user settings are save to the XML settings file. No problem so far. When I exported the settings, my user settings are in the exported XML file. 

    The problem is to load these settings. When I open the option dialog again, the LoadSettingsFromStorage method of my DialogPage class is called! Rather than the LoadSettingsFromXml method. I have no idea how to change this behaviour and I have no idea too, how to load the settings from XML in the  LoadSettingsFromStorage method.

    Hopefully someone can help me with this problem.

    Bye

    Fabian

     

    Friday, July 22, 2011 7:25 AM

Answers

  • Hi Yi,

     

    thx for the clarification. In the meantime I solved the problem. I just use the AutomationObject machanism to save my user settings. This works well as far as I tested it.

     

    Bye

    Traidor

    • Marked as answer by Traidor Wednesday, July 27, 2011 6:59 AM
    Wednesday, July 27, 2011 6:59 AM

All replies

  • Hi Traidor,

     

    You are unable to change this behavior.  

     

    LoadSettingsFromXml is called by the Visual Studio environment when a user chooses the Import/Export Settings command on the Tools menu to retrieve Visual Studio state.

     

    After calling this method, the IDE calls the SaveSettingsToStorage method to save the VSPackage's updated state to local storage (typically the registry) to guarantee that a VSPackage state is consistent when restarted.

     

    You can find the reference at http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.iprofilemanager.loadsettingsfromxml.aspx

     

    Hope the information helps.

    Yi

     

     


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 26, 2011 9:04 AM
  • Hi Yi,

     

    thx for the clarification. In the meantime I solved the problem. I just use the AutomationObject machanism to save my user settings. This works well as far as I tested it.

     

    Bye

    Traidor

    • Marked as answer by Traidor Wednesday, July 27, 2011 6:59 AM
    Wednesday, July 27, 2011 6:59 AM