IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

[app.config] Charger l'app.config via une DLL ou un service, est ce possible?


Sujet :

C#

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    1 002
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 1 002
    Points : 552
    Points
    552
    Par défaut [app.config] Charger l'app.config via une DLL ou un service, est ce possible?
    Bjr,

    est il possible de charger l'app.config depuis une DLL ou un service?? comme depuis un programme...

    si oui comment ?

    merci

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    1 002
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 1 002
    Points : 552
    Points
    552
    Par défaut
    j'ai exactement le meme souci que lui:
    http://www.developpez.net/forums/d50...der-ne-marche/


    au passage "neptune" n'a pas bien pigé que le phénomène se passe lorsque c est une DLL qui cherche son app.config.... lui donne l'exemple d'un executable... et forcement la ca marche bien..


    moi aussi je recois les valeur par defaut...

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    1 002
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 1 002
    Points : 552
    Points
    552
    Par défaut
    hum...
    http://bytes.com/forum/thread276419.html

    Hi Alan,

    We can not apply an app.config file to the class library dll. Because just
    as the name implied, this configuration file is for the application wide.

    I think what "Nicholas Paldino [.NET/C# MVP]" sugggested is to place the
    class library configuration sections into the app.config file where your
    application is in. Then your class library code can read the configuration
    without any problem.

    If you still want a customized config file for class library so that we
    need not copy the config information to all the applications using the dll,
    I think we have to store the configuration information in a XML file, then
    use System.Xml namespace classes to read this XML config file.

    Hope this helps.

    Best regards,
    Jeffrey Tan
    Microsoft Online Partner Support
    Get Secure! - www.microsoft.com/security
    This posting is provided "as is" with no warranties and confers no rights.

  4. #4
    Rédacteur
    Avatar de dev01
    Profil pro
    Inscrit en
    Mai 2004
    Messages
    2 451
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2004
    Messages : 2 451
    Points : 6 017
    Points
    6 017
    Par défaut
    Et en faisant :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Configuration cm = ConfigurationManager.OpenExeConfiguration("MaDll.dll.config");
    ?
    - MVP C#
    -Tout problème a une solution, le vrai problème est de trouver la solution .....
    - Linux & mono : l'avenir

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Octobre 2007
    Messages
    1 002
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2007
    Messages : 1 002
    Points : 552
    Points
    552
    Par défaut
    dev01
    je crois que ca marche pas non plus, mais j'ai pas vérifier ( à l occazz je le dirais)



    par contre la je passe par un service (avec un exe) et ca marche !

    c est deja ca

    merci pour ta réponse !

Discussions similaires

  1. Réponses: 4
    Dernier message: 20/12/2011, 12h00
  2. Charger String Table à partir d'une DLL
    Par MarronSuisse dans le forum MFC
    Réponses: 3
    Dernier message: 26/09/2007, 06h20
  3. Modifier un TPanel via une DLL
    Par Delphi-ne dans le forum Delphi
    Réponses: 4
    Dernier message: 01/12/2006, 13h54
  4. Réponses: 4
    Dernier message: 20/10/2006, 16h19
  5. Sécuriser un répertoire via une DLL
    Par kazarn dans le forum MFC
    Réponses: 2
    Dernier message: 05/03/2005, 17h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo