Comments disappear from appSettings after Save()

  • Thread starter Thread starter Antonio Ooi
  • Start date Start date
A

Antonio Ooi

Hi,

I have the following appSettings in my app.config file:

<appSettings>

<!-- Some comments here -->

<add key="MyKey1" value="1"/>

<!-- Some comments here -->

<add key="MyKey2" value="2"/>

</appSettings>



After issuing the Save method as shown below, all comments under my appSettings section are gone:



Dim fileMap As New Configuration.ExeConfigurationFileMap()

fileMap.ExeConfigFilename = "MyApp.exe.config"

Dim appConfig As Configuration.Configuration = Configuration.ConfigurationManager.OpenMappedExeConfiguration(fileMap, Configuration.ConfigurationUserLevel.None)

With appConfig.AppSettings

.Settings("MyKey1").Value = "10"

.Settings("MyKey2").Value = "20"

End With



appConfig.Save(Configuration.ConfigurationSaveMode.Minimal)



Any way to preserve my comments? Thanks!
 
I have the following appSettings in my app.config file:

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005
and VB Express, which have dropped .NET from their names) are off-topic
here.

Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.

For questions specific to the VB.NET language, use this group:
microsoft.public.dotnet.languages.vb

Please note that things like controls and data access, which have their own
subgroups in the Classic VB hierarchy, are not language-specific in .NET, so
you should look for groups like these:
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
 
Sorry, hahahahaha...............


Jeff Johnson said:
I have the following appSettings in my app.config file:

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB
2005 and VB Express, which have dropped .NET from their names) are
off-topic here.

Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.

For questions specific to the VB.NET language, use this group:
microsoft.public.dotnet.languages.vb

Please note that things like controls and data access, which have their
own subgroups in the Classic VB hierarchy, are not language-specific in
.NET, so you should look for groups like these:
microsoft.public.dotnet.framework.windowsforms.controls
microsoft.public.dotnet.framework.adonet
(Note that "vb" is not present in the group name.)
 
Sorry, hahahahaha...............

I didn't notice the crosspost. Specifically,
microsoft.public.vb.general.discussion is a VB6 group.
dotnet.languages.vb is definitely a good place to ask.
 
Jeff Johnson schreef:
I have the following appSettings in my app.config file:

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005
and VB Express, which have dropped .NET from their names) are off-topic
here.

Please note that the message was posted to several groups, including a
..NET group. Check that first before you post a canned response.
 
C-Services Holland b.v. said:
Jeff Johnson schreef:
I have the following appSettings in my app.config file:

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005
and VB Express, which have dropped .NET from their names) are off-topic
here.

Please note that the message was posted to several groups, including a
.NET group. Check that first before you post a canned response.

Why?
Does it not apply when posted in several groups!
How would YOU recommend informing the original person that they are asking
in the wrong place?
 
NeilH said:
[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET
(including VB 2005 and VB Express, which have dropped .NET from
their names) are off-topic here.

Please note that the message was posted to several groups,
including a .NET group. Check that first before you post a canned
response.

Why?
Does it not apply when posted in several groups!
How would YOU recommend informing the original person that they are
asking in the wrong place?

By mentioning specifically which group is inappropriate, and asking
them to trim it from the list when replying. You can also set
followups to the most appropriate group.

For example, please trim microsoft.public.dotnet.languages.vb when
replying to this (-:
 
I have the following appSettings in my app.config file:

[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB
2005 and VB Express, which have dropped .NET from their names) are
off-topic here.

Please note that the message was posted to several groups, including a
.NET group. Check that first before you post a canned response.

Please note that FOUR DAYS AGO I noticed this and posted a follow-up
message. Check that first before you post a bitchy response.
 
Jeff Johnson schreef:
I have the following appSettings in my app.config file:
[Canned response]
This is a VB "classic" newsgroup. Questions about VB.NET (including VB
2005 and VB Express, which have dropped .NET from their names) are
off-topic here.
Please note that the message was posted to several groups, including a
.NET group. Check that first before you post a canned response.

Please note that FOUR DAYS AGO I noticed this and posted a follow-up
message. Check that first before you post a bitchy response.

Well, you posted a bitchy canned response. So now you know how it feels ;)
 
Back
Top