Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. solution config file ?

solution config file ?

Scheduled Pinned Locked Moved Visual Basic
helpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    ttilque
    wrote on last edited by
    #1

    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.

    N 1 Reply Last reply
    0
    • T ttilque

      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.

      N Offline
      N Offline
      Naji El Kotob
      wrote on last edited by
      #2

      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...

      T 1 Reply Last reply
      0
      • N Naji El Kotob

        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...

        T Offline
        T Offline
        ttilque
        wrote on last edited by
        #3

        Pardon my ingorance but what should cfg be declared as ? Thanks in advance...

        D 1 Reply Last reply
        0
        • T ttilque

          Pardon my ingorance but what should cfg be declared as ? Thanks in advance...

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          You can find that out by looking at the return type of the ConfigurationManager.OpenMappedExeConfiguration method, which is Configuration out of the System.Configuration namespace.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups