solution config file ?
-
We are developing a windows application that has several projects under one solution. The problem we have run into is that we have connectionstrings in app.config files for each project. We would like to have just one config file that all of the projects in the solution use. Is there a way to do this or are there other ways that people normally handle this.
-
We are developing a windows application that has several projects under one solution. The problem we have run into is that we have connectionstrings in app.config files for each project. We would like to have just one config file that all of the projects in the solution use. Is there a way to do this or are there other ways that people normally handle this.
Hi, Dim cfgMap As New ExeConfigurationFileMap cfgMap.ExeConfigFilename = "MyConfigFile.exe.config" cfg = ConfigurationManager.OpenMappedExeConfiguration(cfgMap, ConfigurationUserLevel.None) For i As Integer = 0 To cfg.ConnectionStrings.ConnectionStrings.Count - 1 MsgBox(cfg.ConnectionStrings.ConnectionStrings(i).ConnectionString) Next Note: The type of extra applications in your solution is dll or exe? Hope this helps :)
NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice...
-
Hi, Dim cfgMap As New ExeConfigurationFileMap cfgMap.ExeConfigFilename = "MyConfigFile.exe.config" cfg = ConfigurationManager.OpenMappedExeConfiguration(cfgMap, ConfigurationUserLevel.None) For i As Integer = 0 To cfg.ConnectionStrings.ConnectionStrings.Count - 1 MsgBox(cfg.ConnectionStrings.ConnectionStrings(i).ConnectionString) Next Note: The type of extra applications in your solution is dll or exe? Hope this helps :)
NajiCo http://www.InsideVB.NET[^] It's nice 2b important, but it's more important 2b nice...
-
You can find that out by looking at the return type of the
ConfigurationManager.OpenMappedExeConfiguration
method, which isConfiguration
out of theSystem.Configuration
namespace.A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007