Where to put App.config

Discussion in 'ASP .Net' started by WT, Feb 22, 2006.

  1. WT

    WT Guest

    My web site is using a library created in a separate project.
    VS 2005 has created for it an App.config file.
    The library is included as a refernce in my web site.
    When I copied my web site to it's destination the app.config has not been
    copied by vs 2005. The library itself is in the bin directory.
    Should I copy it manually and where to install it: in root file project or
    in bin ?

    Thanks for help
    CS
     
    WT, Feb 22, 2006
    #1
    1. Advertisements

  2. CS,

    App.Config files do not work with dll assemblies, only executables. Take the
    entries from the app.config file and paste them into the appropriate sections
    of your web.config and they will be avaiable to your app and any class
    libraries that it uses.
    Peter

    --
    Co-founder, Eggheadcafe.com developer portal:
    http://www.eggheadcafe.com
    UnBlog:
    http://petesbloggerama.blogspot.com




    "WT" wrote:

    > My web site is using a library created in a separate project.
    > VS 2005 has created for it an App.config file.
    > The library is included as a refernce in my web site.
    > When I copied my web site to it's destination the app.config has not been
    > copied by vs 2005. The library itself is in the bin directory.
    > Should I copy it manually and where to install it: in root file project or
    > in bin ?
    >
    > Thanks for help
    > CS
    >
    >
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Feb 22, 2006
    #2
    1. Advertisements

  3. Thanks for Peter's input.

    Hi CS,

    As Peter has mentioned, for .net application, the config file(app.config or
    web.config) is only available at application level(winform ,console or
    asp.net applications....). And the app.config file in Class library project
    is just used to simulate the app.config or web.config file in concrete
    application, so that we can convenient write code to accessing config file
    elements or let the IDE conveniently generate some content for components
    in app.config file.

    When you want to reference a certain class library in your application, if
    you need to also use those settings in the class library's app.config (or
    update them), you need to copy the certain configuration sections in the
    class librray's app.config into the concrete application's application
    config file (app.config or web.config). Thus, when using in the
    application, the class library will read those setting from the
    application's app.config or web.config file...

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Feb 23, 2006
    #3
  4. WT

    WT Guest

    Thanks Peter and Steve for clear answer.
    I was not used to this with VS2003 that was not automatically generating
    app.config for dll assemblies.
    CS

    "Steven Cheng[MSFT]" <> a écrit dans le message
    de news: ...
    > Thanks for Peter's input.
    >
    > Hi CS,
    >
    > As Peter has mentioned, for .net application, the config file(app.config
    > or
    > web.config) is only available at application level(winform ,console or
    > asp.net applications....). And the app.config file in Class library
    > project
    > is just used to simulate the app.config or web.config file in concrete
    > application, so that we can convenient write code to accessing config file
    > elements or let the IDE conveniently generate some content for components
    > in app.config file.
    >
    > When you want to reference a certain class library in your application, if
    > you need to also use those settings in the class library's app.config (or
    > update them), you need to copy the certain configuration sections in the
    > class librray's app.config into the concrete application's application
    > config file (app.config or web.config). Thus, when using in the
    > application, the class library will read those setting from the
    > application's app.config or web.config file...
    >
    > Regards,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    >
    >
     
    WT, Feb 23, 2006
    #4
  5. You're welcome.

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
     
    Steven Cheng[MSFT], Feb 23, 2006
    #5
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ad
    Replies:
    1
    Views:
    3,807
    Christopher Reed
    Mar 30, 2006
  2. Replies:
    4
    Views:
    10,417
    Kevin Spencer
    Apr 5, 2006
  3. CSharpner
    Replies:
    0
    Views:
    1,237
    CSharpner
    Apr 9, 2007
  4. vbjohn
    Replies:
    0
    Views:
    581
    vbjohn
    Jan 29, 2008
  5. leeanne
    Replies:
    0
    Views:
    1,972
    leeanne
    Sep 24, 2008
Loading...

Share This Page