Comment modifier la config de mon service windows lors du setup

Résolu
ghanmi04_05 Messages postés 20 Date d'inscription mardi 10 mai 2005 Statut Membre Dernière intervention 23 mars 2010 - 28 avril 2009 à 19:10
ghanmi04_05 Messages postés 20 Date d'inscription mardi 10 mai 2005 Statut Membre Dernière intervention 23 mars 2010 - 30 avril 2009 à 19:50
Salut,
J'ai réalisé un service windows en c#, j'ai généré le setup ça marche sans pbm, mais quand j'ai voulu personaliser le setup çad ajouter une Zone de Text(A) puis récupérer la valeur et changer le mon_service.exe.config lors de l'install(comme le web.config web) j'ai pas réuci à la faire,voilà la partie qui marche pas:
*****************************
///Recuperer la valeur de l'interface de mon setup
String txtMySiteSerice = this.Context.Parameters["webservice"];
//Assembly Asm = Assembly.GetExecutingAssembly();
//String chemin="";
// Environment.CurrentDirectory= System.IO.Path.GetDirectoryName (System.Reflection.Assembly.GetEntryAssembly().Location);
// string path = System.IO.Path.GetFullPath(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
Assembly Asm = Assembly.GetExecutingAssembly();
String chemin;
chemin = Asm.Location.Substring(0, Asm.Location.Length - Asm.GetName().Name.Length - 8)+"\\mon_service.exe.config"; //Pour le web ça marche
// Le FileInfo va nous permettre de voir que le fichier Web.config existe bel et bien.
FileInfo FileInfo1 = new FileInfo(chemin);
*******************************
/// Modification de mon config....
Help
IDE: VS 2005, .net 2.0, Service Windows
Cmt

1 réponse

ghanmi04_05 Messages postés 20 Date d'inscription mardi 10 mai 2005 Statut Membre Dernière intervention 23 mars 2010
30 avril 2009 à 19:50
chemin = Asm.Location.Substring(0, Asm.Location.Length - Asm.GetName().Name.Length - 5)

(5 au lieu de 8) 8 pour web! et 5 pour mon service windows, ça marche
3
Rejoignez-nous