3

(My question is similar to this one, but the code is slightly different, and the solution doesn't work for me)

I'm trying to save settings changes to the app.config:

Dim config As System.Configuration.Configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)
config.AppSettings.Settings("HistoryRootDirectoryPath").Value = p_historySavingPath
config.Save(ConfigurationSaveMode.Modified)
ConfigurationManager.RefreshSection("appSettings")

Nothing is saved neither to the exe.config file in bin folder, and not to the actual app.config file. What am I doing wrong?

Community
  • 1
  • 1
MichaelS
  • 7,023
  • 10
  • 51
  • 75

1 Answers1

5

Finally ended finding the changes are being saved under .vshost.exe.config.

As Oded mentioned,that is because the code is being run under the Visual Studio process host.

Note that the changes are being reverted once you stop the process run.

Community
  • 1
  • 1
MichaelS
  • 7,023
  • 10
  • 51
  • 75