Reputation: 41
I have an application that has a load of values in its app.exe.config file. The application is used by a few users, and the settings would change on a regular basis. so im having to change the config file, and send it out to all users.
I'd love to move the config file to the network somewhere and point the app to this file. ive tried to use;
Imports System.Configuration.ConfigurationManager
OpenExeConfiguration("I:\app config\HelpDeskQuickCallLogger.exe.config")
But i cant get it to read in the values.
Anyone any ideas?
Upvotes: 4
Views: 2970
Reputation: 44931
This is how we handle this requirement if a specific configuration file (sSpecificConfigurationFile) is specified:
Dim oConfig As System.Configuration.Configuration
If sSpecificConfigurationFile.EndsWith(".config", StringComparison.InvariantCultureIgnoreCase) Then
Dim oMap As New ExeConfigurationFileMap
oMap.ExeConfigFilename = sSpecificConfigurationFile
oConfig = ConfigurationManager.OpenMappedExeConfiguration(oMap, ConfigurationUserLevel.None)
Else
oConfig = ConfigurationManager.OpenExeConfiguration(sSpecificConfigurationFile)
End If
Upvotes: 1