Hi, thanks, mister
The code
string rutaConfig = tbRutaConfigSer vicioBase.Text;
'// Map to the application configuration file.
ExeConfiguratio nFileMap configFile = New ExeConfiguratio nFileMap();
configFile.ExeC onfigFilename = rutaConfig;
Dim config As Configuration =
ConfigurationMa nager.OpenMappe dExeConfigurati on(configFile,
ConfigurationUs erLevel.None);
string[] keys = config.AppSetti ngs.Settings.Al lKeys;
KeyValueConfigu rationCollectio n settings1 = config.AppSetti ngs.Settings();
settings1("GRUP OBACKUP.Ruta_Gr abar_Ficheros") .Value =
tbGRUPOBACKUP_R uta_Grabar_Fich eros.Text;
settings1("SERV IDOR_INDEXADO") .Value = tbSERVIDOR_INDE XADO.Text;
settings1("PDF_ CREADOR").Value = tbPDF_CREADOR.T ext;
settings1("PDF_ AUTOR").Value = tbPDF_AUTOR.Tex t;
settings1("PDF_ TITULO").Value = tbPDF_TITULO.Te xt;
settings1("PDF_ ASUNTO").Value = tbPDF_ASUNTO.Te xt;
config.Connecti onStrings.Conne ctionStrings["SQLConnect ion"].ConnectionStri ng
= tbCadenaConexio nFirmasParaServ icioBase.Text;
config.Connecti onStrings.Conne ctionStrings["SQLConnectionS ecundaria"].ConnectionStri ng = tbCadenaConexio nOGFParaServici oBase.Text;
' Modifica el app.config pero pierde los comentarios del appsettings
' Asà se modifica el app.config pero añade secciones vacÃas, modifica
bastante la estructura. Además al utilizar EnterpriseLibra ry se producen
errores de ensamblados
config.Save(Con figurationSaveM ode.Modified, True); ' <==== Fails here !!!
The error:
System.Configur ation.Configura tionErrorsExcep tion was unhandled
BareMessage="Se ha producido un error al crear el controlador de sección
de configuración para exceptionHandli ng: No se puede cargar el archivo o
ensamblado 'Microsoft.Prac tices.Enterpris eLibrary.Except ionHandling,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= null' ni una de sus
dependencias. El sistema no puede hallar el archivo especificado."
Filename="C:\Ar chivos de programa\GRUPO BACKUP\GRUPO BACKUP Servicios
Principales OGF\ServicioBas e.exe.config"
Line=5
Message="Se ha producido un error al crear el controlador de sección de
configuración para exceptionHandli ng: No se puede cargar el archivo o
ensamblado 'Microsoft.Prac tices.Enterpris eLibrary.Except ionHandling,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= null' ni una de sus
dependencias. El sistema no puede hallar el archivo especificado.
(C:\Archivos de programa\GRUPO BACKUP\GRUPO BACKUP Servicios Principales
OGF\ServicioBas e.exe.config line 5)"
Source="System. Configuration"
StackTrace:
en
System.Configur ation.BaseConfi gurationRecord. FindAndEnsureFa ctoryRecord(Str ing configKey, Boolean& isRootDeclaredH ere)
en
System.Configur ation.BaseConfi gurationRecord. GetSectionRecur sive(String
configKey, Boolean getLkg, Boolean checkPermission , Boolean getRuntimeObjec t,
Boolean requestIsHere, Object& result, Object& resultRuntimeOb ject)
en System.Configur ation.BaseConfi gurationRecord. GetSection(Stri ng
configKey, Boolean getLkg, Boolean checkPermission )
en System.Configur ation.Configura tionSectionColl ection.Get(Stri ng name)
en
System.Configur ation.Configura tionSectionColl ection.<GetEnum erator>d__0.Mov eNext()
en
System.Configur ation.Configura tion.ForceGroup sRecursive(Conf igurationSectio nGroup group)
en System.Configur ation.Configura tion.SaveAsImpl (String filename,
ConfigurationSa veMode saveMode, Boolean forceSaveAll)
en System.Configur ation.Configura tion.Save(Confi gurationSaveMod e
saveMode, Boolean forceSaveAll)
en
GRUPOBACKUP.Ins taladorConfigur adorOGF.Cliente .Util.FPrincipa l.bGuardarConfi guracionServici oBase_Click(Obj ect
sender, EventArgs e) en
D:\DESA\Expedie nteElectronico\ Instalacion\Ins taladorConfigur ador\GRUPOBACKU P.InstaladorCon figuradorOGF.Cl iente.Util\FPri ncipal.vb:lÃne a 231
en System.Windows. Forms.Control.O nClick(EventArg s e)
en System.Windows. Forms.Button.On Click(EventArgs e)
en System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
en System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
en System.Windows. Forms.Control.W ndProc(Message& m)
en System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
en System.Windows. Forms.Button.Wn dProc(Message& m)
en
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
en System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
en System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G& msg)
en
System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
en
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
en
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
en System.Windows. Forms.Applicati on.Run(Form mainForm)
en GRUPOBACKUP.Ins taladorConfigur adorOGF.Program .Main() en
D:\DESA\Expedie nteElectronico\ Instalacion\Ins taladorConfigur ador\GRUPOBACKU P.InstaladorCon figuradorOGF\Pr ogram.cs:lÃnea 19
en System.AppDomai n._nExecuteAsse mbly(Assembly assembly, String[] args)
en System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence
assemblySecurit y, String[] args)
en Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
en System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
en System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
en System.Threadin g.ThreadHelper. ThreadStart()
line 5 in app.config
<section name="exception Handling"
type="Microsoft .Practices.Ente rpriseLibrary.E xceptionHandlin g.Configuration .ExceptionHandl ingSettings,
Microsoft.Pract ices.Enterprise Library.Excepti onHandling, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= null" />
The app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<configSections >
<section name="loggingCo nfiguration"
type="Microsoft .Practices.Ente rpriseLibrary.L ogging.Configur ation.LoggingSe ttings,
Microsoft.Pract ices.Enterprise Library.Logging , Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= null" />
<section name="exception Handling"
type="Microsoft .Practices.Ente rpriseLibrary.E xceptionHandlin g.Configuration .ExceptionHandl ingSettings,
Microsoft.Pract ices.Enterprise Library.Excepti onHandling, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= null" />
</configSections>
<appSettings>
....
IMPORTANT: If copy assemblies of EnterpriseLibra ry where I have my project
output, all works fine.
Thanks in advance.
--
http://www.setbb.com/putainformatica...opic.php?p=843
The code
string rutaConfig = tbRutaConfigSer vicioBase.Text;
'// Map to the application configuration file.
ExeConfiguratio nFileMap configFile = New ExeConfiguratio nFileMap();
configFile.ExeC onfigFilename = rutaConfig;
Dim config As Configuration =
ConfigurationMa nager.OpenMappe dExeConfigurati on(configFile,
ConfigurationUs erLevel.None);
string[] keys = config.AppSetti ngs.Settings.Al lKeys;
KeyValueConfigu rationCollectio n settings1 = config.AppSetti ngs.Settings();
settings1("GRUP OBACKUP.Ruta_Gr abar_Ficheros") .Value =
tbGRUPOBACKUP_R uta_Grabar_Fich eros.Text;
settings1("SERV IDOR_INDEXADO") .Value = tbSERVIDOR_INDE XADO.Text;
settings1("PDF_ CREADOR").Value = tbPDF_CREADOR.T ext;
settings1("PDF_ AUTOR").Value = tbPDF_AUTOR.Tex t;
settings1("PDF_ TITULO").Value = tbPDF_TITULO.Te xt;
settings1("PDF_ ASUNTO").Value = tbPDF_ASUNTO.Te xt;
config.Connecti onStrings.Conne ctionStrings["SQLConnect ion"].ConnectionStri ng
= tbCadenaConexio nFirmasParaServ icioBase.Text;
config.Connecti onStrings.Conne ctionStrings["SQLConnectionS ecundaria"].ConnectionStri ng = tbCadenaConexio nOGFParaServici oBase.Text;
' Modifica el app.config pero pierde los comentarios del appsettings
' Asà se modifica el app.config pero añade secciones vacÃas, modifica
bastante la estructura. Además al utilizar EnterpriseLibra ry se producen
errores de ensamblados
config.Save(Con figurationSaveM ode.Modified, True); ' <==== Fails here !!!
The error:
System.Configur ation.Configura tionErrorsExcep tion was unhandled
BareMessage="Se ha producido un error al crear el controlador de sección
de configuración para exceptionHandli ng: No se puede cargar el archivo o
ensamblado 'Microsoft.Prac tices.Enterpris eLibrary.Except ionHandling,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= null' ni una de sus
dependencias. El sistema no puede hallar el archivo especificado."
Filename="C:\Ar chivos de programa\GRUPO BACKUP\GRUPO BACKUP Servicios
Principales OGF\ServicioBas e.exe.config"
Line=5
Message="Se ha producido un error al crear el controlador de sección de
configuración para exceptionHandli ng: No se puede cargar el archivo o
ensamblado 'Microsoft.Prac tices.Enterpris eLibrary.Except ionHandling,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= null' ni una de sus
dependencias. El sistema no puede hallar el archivo especificado.
(C:\Archivos de programa\GRUPO BACKUP\GRUPO BACKUP Servicios Principales
OGF\ServicioBas e.exe.config line 5)"
Source="System. Configuration"
StackTrace:
en
System.Configur ation.BaseConfi gurationRecord. FindAndEnsureFa ctoryRecord(Str ing configKey, Boolean& isRootDeclaredH ere)
en
System.Configur ation.BaseConfi gurationRecord. GetSectionRecur sive(String
configKey, Boolean getLkg, Boolean checkPermission , Boolean getRuntimeObjec t,
Boolean requestIsHere, Object& result, Object& resultRuntimeOb ject)
en System.Configur ation.BaseConfi gurationRecord. GetSection(Stri ng
configKey, Boolean getLkg, Boolean checkPermission )
en System.Configur ation.Configura tionSectionColl ection.Get(Stri ng name)
en
System.Configur ation.Configura tionSectionColl ection.<GetEnum erator>d__0.Mov eNext()
en
System.Configur ation.Configura tion.ForceGroup sRecursive(Conf igurationSectio nGroup group)
en System.Configur ation.Configura tion.SaveAsImpl (String filename,
ConfigurationSa veMode saveMode, Boolean forceSaveAll)
en System.Configur ation.Configura tion.Save(Confi gurationSaveMod e
saveMode, Boolean forceSaveAll)
en
GRUPOBACKUP.Ins taladorConfigur adorOGF.Cliente .Util.FPrincipa l.bGuardarConfi guracionServici oBase_Click(Obj ect
sender, EventArgs e) en
D:\DESA\Expedie nteElectronico\ Instalacion\Ins taladorConfigur ador\GRUPOBACKU P.InstaladorCon figuradorOGF.Cl iente.Util\FPri ncipal.vb:lÃne a 231
en System.Windows. Forms.Control.O nClick(EventArg s e)
en System.Windows. Forms.Button.On Click(EventArgs e)
en System.Windows. Forms.Button.On MouseUp(MouseEv entArgs mevent)
en System.Windows. Forms.Control.W mMouseUp(Messag e& m, MouseButtons
button, Int32 clicks)
en System.Windows. Forms.Control.W ndProc(Message& m)
en System.Windows. Forms.ButtonBas e.WndProc(Messa ge& m)
en System.Windows. Forms.Button.Wn dProc(Message& m)
en
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
en System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
en System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G& msg)
en
System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
en
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
en
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
en System.Windows. Forms.Applicati on.Run(Form mainForm)
en GRUPOBACKUP.Ins taladorConfigur adorOGF.Program .Main() en
D:\DESA\Expedie nteElectronico\ Instalacion\Ins taladorConfigur ador\GRUPOBACKU P.InstaladorCon figuradorOGF\Pr ogram.cs:lÃnea 19
en System.AppDomai n._nExecuteAsse mbly(Assembly assembly, String[] args)
en System.AppDomai n.ExecuteAssemb ly(String assemblyFile, Evidence
assemblySecurit y, String[] args)
en Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem bly()
en System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
en System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
en System.Threadin g.ThreadHelper. ThreadStart()
line 5 in app.config
<section name="exception Handling"
type="Microsoft .Practices.Ente rpriseLibrary.E xceptionHandlin g.Configuration .ExceptionHandl ingSettings,
Microsoft.Pract ices.Enterprise Library.Excepti onHandling, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= null" />
The app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuratio n>
<configSections >
<section name="loggingCo nfiguration"
type="Microsoft .Practices.Ente rpriseLibrary.L ogging.Configur ation.LoggingSe ttings,
Microsoft.Pract ices.Enterprise Library.Logging , Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= null" />
<section name="exception Handling"
type="Microsoft .Practices.Ente rpriseLibrary.E xceptionHandlin g.Configuration .ExceptionHandl ingSettings,
Microsoft.Pract ices.Enterprise Library.Excepti onHandling, Version=2.0.0.0 ,
Culture=neutral , PublicKeyToken= null" />
</configSections>
<appSettings>
....
IMPORTANT: If copy assemblies of EnterpriseLibra ry where I have my project
output, all works fine.
Thanks in advance.
--
http://www.setbb.com/putainformatica...opic.php?p=843