Windows Develop Bookmark and Share   
 index > Windows Forms General > Where does ToolStripManager.SaveSettings save to?
 

Where does ToolStripManager.SaveSettings save to?

I am using MenuStrips and ToolStrips where the user can move them around and also change the order of the items therein. I use ToolStripManager.SaveSettings to persist these position/order information and I use ToolStripManager.LoadSettings to retrieve them.

On my PC (Vista), the settings are saved in a file named user.config located in Application.LocalUserAppDataPath + @"\my_company_name\Xxxx.exe+StrongName_umcsk13vhyzovqdqq305np5g01t2kq00\a.b.c.d" when:

a. My application exe name is Xxxx.
b.The company attribute is [assembly: AssemblyCompany("my company name")]. Notice that underscores are added in the path name even though the attribute has only spaces.
c. The assembly version isa.b.c.d.

umcsk13vh...2kq00 is not the public key nor public key token for the assembly.

There appears to be a bug in the user.config file and I now need to correct it manually. May I know what is the proper way to get the location of this folder where user.config is located.

Thanks.
  • Moved byeryangMSFTThursday, September 17, 2009 3:19 AMnot clr issue. (From:Common Language Runtime)
  • Edited byK.Kong Wednesday, September 16, 2009 3:17 AMtypo
  •  
K.Kong  Wednesday, September 16, 2009 3:13 AM

Hi,

You can get the path using Configuration Management API.

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);

Console.WriteLine("Local user config path: {0}", config.FilePath);

You can get more information about setting in this blog: http://blogs.msdn.com/rprabhu/articles/433979.aspx

The second Q/A tells about user data path.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Wednesday, September 23, 2009 2:57 AM
You want to get to the directory in code? Or just through the file system?



www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Thursday, September 17, 2009 4:14 AM
In code. I need the actual run-time location.

The user.config file is in an unusually obscure location. How do I find out the part of the path after Application.LocalUserAppDataPath?

Thanks.
K.Kong  Thursday, September 17, 2009 5:42 AM
I did some tests. It appears that whenever a Windows Form application has ToolStrip or MenuStrip, a user.config file is created in Application.LocalUserAppDataPath + @"\company_name\application_name.exe_StrongName_xxxxxxxxxxxxxx\assemblyversion".

Underscores are added in lieu of spaces in the company name and application name attributes.

There is a cryptic long string after _StrongName_.
K.Kong  Thursday, September 17, 2009 6:47 AM

Hi,

You can get the path using Configuration Management API.

Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);

Console.WriteLine("Local user config path: {0}", config.FilePath);

You can get more information about setting in this blog: http://blogs.msdn.com/rprabhu/articles/433979.aspx

The second Q/A tells about user data path.

Best regards,

Ling Wang


Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Wednesday, September 23, 2009 2:57 AM
Thanks. Just what I need.
K.Kong  Wednesday, September 23, 2009 4:09 AM

You can use google to search for other answers

Custom Search

More Threads

• Refresh Form Without Changing Its Position
• Control.BeginInvoke multiple times: execution order?
• Threading question
• WebBrowser. How to redirect when network error or 404? (new user)
• Dropdownlist checkbox or multiselect
• Wait for event before continuing in method
• In PropertyGrid, the problem on sorting Generic List. Help!
• DataGridView scroll bar problem
• Microsoft Web Browser control
• Re-arranging controls during runtime.