views:

171

answers:

4

My VB.NET 2008, .NET 3.5 application is using an app.config with settings defined as User. As expected, it created the folder:

C:\Documents and Settings\<user>\Local Settings\Application Data\<company name>\

In this folder are the sub-folders for the application to store the user settings. However, the folder of the company name has underscores:

C:\Documents and Settings\<user>\Local Settings\Application Data\This__Is_My_Company\

None of the other folders in this directory have underscores, and it looks stupid. Is there any way to tell the application to create the folder without underscores in the name?

A: 

i would use reflector to inspect the code thats putting the _ in there in the first place and see if its got any ifs in it

pm100
or learn to love the _ characters
pm100
A: 

Does your company name have spaces in it? I know that spaces in folder names are perfectly acceptable, but it may be that VB 2008 is trying to be a little bit too clever and "saving you from yourself".

If that turns out to be the case, have a look in the My Project\Settings.designer.vb file. You may find the code that generates the name in there and be able to modify it manually. I would check myself, but I can't lay my hands on a copy of VB 2008 until tomorrow. :-)

Christian Hayter
Our company name does have spaces. Nothing but my own setting in Settings.designer.vb. The company name in AssemblyInfo.vb is correct with spaces. No luck yet figuring this out.
HardCode
A: 

In the AssemblyInfo.cs what does it have for you company name? Does it have the underscores?

J.13.L
A: 

The LocalFileSettingsProvider class is responsible by default for storing config settings in .NET. It seems to put in underscores for all managed applications by default - I see it in several apps in my local settings directory. If you are really concerned about the name, you could:

  1. Use the technique described in Changing the .NET application configuration file name question.
  2. Create your own SettingsProvider and have it use the right filename. This sounds like re-inventing the wheel though.
  3. Use camel-case for your company name.
antonm