App.config

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michael

    #1

    App.config

    Ok, I'm totally confused...

    I want to store my db connect strings in the app.config file. So I added an
    app.config file and renamed it to MyApp.exe.confi g
    Everything I've read says that it has to be located in the same dir as the
    exe so I put it in the /bin directory. Now I run the app (in debug mode from
    the IDE) and .... MyApp.exe.confi g is now gone!

    Please point me in the right direction.
    Thanks

    Michael


  • Zoury

    #2
    Re: App.config

    Hi Micheal ! :O)

    Simply don't rename/move the app.config file.

    When you first add it to a project, it is created in the project location
    (vbproj) with the name App.config. Then, when you build your application,
    the file gets copied in the \bin directory with the following name format
    [your app name].exe.config.

    Thus, any changes you make to this file should be done in the App.config
    file which will overwrite the \bin\[your app name].exe.config file at
    "compile time".

    --
    Best Regards
    Yanick
    "Michael" <xxx.xxx.xxx> a écrit dans le message de
    news:OvjRHNecFH A.2756@tk2msftn gp13.phx.gbl...[color=blue]
    > Ok, I'm totally confused...
    >
    > I want to store my db connect strings in the app.config file. So I added[/color]
    an[color=blue]
    > app.config file and renamed it to MyApp.exe.confi g
    > Everything I've read says that it has to be located in the same dir as[/color]
    the[color=blue]
    > exe so I put it in the /bin directory. Now I run the app (in debug mode[/color]
    from[color=blue]
    > the IDE) and .... MyApp.exe.confi g is now gone!
    >
    > Please point me in the right direction.
    > Thanks
    >
    > Michael
    >
    >[/color]


    Comment

    • Michael

      #3
      Re: App.config

      Much thanks... the nothing I read told me anything about that..it all said
      to add it to /bin

      Michael
      "Zoury" <yanick_lefebvr e at hotmail dot com> wrote in message
      news:O2uBx8ecFH A.2664@TK2MSFTN GP15.phx.gbl...[color=blue]
      > Hi Micheal ! :O)
      >
      > Simply don't rename/move the app.config file.
      >
      > When you first add it to a project, it is created in the project location
      > (vbproj) with the name App.config. Then, when you build your application,
      > the file gets copied in the \bin directory with the following name format
      > [your app name].exe.config.
      >
      > Thus, any changes you make to this file should be done in the App.config
      > file which will overwrite the \bin\[your app name].exe.config file at
      > "compile time".
      >
      > --
      > Best Regards
      > Yanick
      > "Michael" <xxx.xxx.xxx> a écrit dans le message de
      > news:OvjRHNecFH A.2756@tk2msftn gp13.phx.gbl...[color=green]
      > > Ok, I'm totally confused...
      > >
      > > I want to store my db connect strings in the app.config file. So I added[/color]
      > an[color=green]
      > > app.config file and renamed it to MyApp.exe.confi g
      > > Everything I've read says that it has to be located in the same dir as[/color]
      > the[color=green]
      > > exe so I put it in the /bin directory. Now I run the app (in debug mode[/color]
      > from[color=green]
      > > the IDE) and .... MyApp.exe.confi g is now gone!
      > >
      > > Please point me in the right direction.
      > > Thanks
      > >
      > > Michael
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Michael Earls

        #4
        Re: App.config

        That's how you'd do it without Visual Studio. ;) VS.NET will do the work
        for you.

        --
        Michael Earls
        The Cerebral Kitchen



        "Michael" <xxx.xxx.xxx> wrote in message
        news:%23nMqtjfc FHA.2960@TK2MSF TNGP09.phx.gbl. ..[color=blue]
        > Much thanks... the nothing I read told me anything about that..it all said
        > to add it to /bin
        >
        > Michael
        > "Zoury" <yanick_lefebvr e at hotmail dot com> wrote in message
        > news:O2uBx8ecFH A.2664@TK2MSFTN GP15.phx.gbl...[color=green]
        >> Hi Micheal ! :O)
        >>
        >> Simply don't rename/move the app.config file.
        >>
        >> When you first add it to a project, it is created in the project location
        >> (vbproj) with the name App.config. Then, when you build your application,
        >> the file gets copied in the \bin directory with the following name format
        >> [your app name].exe.config.
        >>
        >> Thus, any changes you make to this file should be done in the App.config
        >> file which will overwrite the \bin\[your app name].exe.config file at
        >> "compile time".
        >>
        >> --
        >> Best Regards
        >> Yanick
        >> "Michael" <xxx.xxx.xxx> a écrit dans le message de
        >> news:OvjRHNecFH A.2756@tk2msftn gp13.phx.gbl...[color=darkred]
        >> > Ok, I'm totally confused...
        >> >
        >> > I want to store my db connect strings in the app.config file. So I
        >> > added[/color]
        >> an[color=darkred]
        >> > app.config file and renamed it to MyApp.exe.confi g
        >> > Everything I've read says that it has to be located in the same dir as[/color]
        >> the[color=darkred]
        >> > exe so I put it in the /bin directory. Now I run the app (in debug mode[/color]
        >> from[color=darkred]
        >> > the IDE) and .... MyApp.exe.confi g is now gone!
        >> >
        >> > Please point me in the right direction.
        >> > Thanks
        >> >
        >> > Michael
        >> >
        >> >[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        • _AnonCoward

          #5
          Re: App.config

          If you compile from the command line and copy the binary to the /bin
          directory yourself, then the manual steps you took would be appropriate.
          However, you are in the IDE and it handles all of that for you. In fact,
          I'm pretty sure that if you run your code from within the IDE, it is
          running in the project folder, not the /bin, so it won't find your
          ..config file.


          Ralf


          "Michael" <xxx.xxx.xxx> wrote in message
          news:%23nMqtjfc FHA.2960@TK2MSF TNGP09.phx.gbl. ..
          : Much thanks... the nothing I read told me anything about that..it all
          said
          : to add it to /bin
          :
          : Michael
          : "Zoury" <yanick_lefebvr e at hotmail dot com> wrote in message
          : news:O2uBx8ecFH A.2664@TK2MSFTN GP15.phx.gbl...
          : > Hi Micheal ! :O)
          : >
          : > Simply don't rename/move the app.config file.
          : >
          : > When you first add it to a project, it is created in the project
          location
          : > (vbproj) with the name App.config. Then, when you build your
          application,
          : > the file gets copied in the \bin directory with the following name
          format
          : > [your app name].exe.config.
          : >
          : > Thus, any changes you make to this file should be done in the
          App.config
          : > file which will overwrite the \bin\[your app name].exe.config file
          at
          : > "compile time".
          : >
          : > --
          : > Best Regards
          : > Yanick
          : > "Michael" <xxx.xxx.xxx> a écrit dans le message de
          : > news:OvjRHNecFH A.2756@tk2msftn gp13.phx.gbl...
          : > > Ok, I'm totally confused...
          : > >
          : > > I want to store my db connect strings in the app.config file. So I
          added
          : > an
          : > > app.config file and renamed it to MyApp.exe.confi g
          : > > Everything I've read says that it has to be located in the same
          dir as
          : > the
          : > > exe so I put it in the /bin directory. Now I run the app (in debug
          mode
          : > from
          : > > the IDE) and .... MyApp.exe.confi g is now gone!
          : > >
          : > > Please point me in the right direction.
          : > > Thanks
          : > >
          : > > Michael
          : > >
          : > >
          : >
          : >
          :
          :



          Comment

          Working...