Config file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to change (add or edit some items to) .Config file of an application
during set up. Which classes are supported by .Net? Does .Net have a class to
change contents of a .Config file?

Regards.
Reza.
 
Hello Reza,

Since the .config file is purely XML, you can use XmlDocument to load this
file and modify it as necessary. I would recommend this only be done during
the install procedure (as you're suggesting).
 
Hi,

I have a similar question to Reza's. I want to get the CodeBase of the
dll file so I can determine the path for my config file, which I want
to store in the same directory with dll. But when I use
System.Reflection.Assembly.GetCallingAssembly.CodeBase it keeps
returning the GAC directory
C:\WINNT\assembly\gac\LibName\[verNumber_pubKeyToken] instead of
D:\ApplicationPath\dll\. Is there a way to come this? Are there
different classes or methods I should use in lieu of
System.Reflection.Assembly?

-Sharon
 
Hello Sharon,

You do know that you can use the ConfigurationSettings API inside your DLL
and it will retrieve the application's configuration...
 
Thank you Matt

Matt Berther said:
Hello Reza,

Since the .config file is purely XML, you can use XmlDocument to load this
file and modify it as necessary. I would recommend this only be done during
the install procedure (as you're suggesting).
 
Hello Matt,

Thank you for your reply. It's a COM interop for a ASP/COM+ web-based
application. I tried using web.config but ASP didn't recognize the
settings.

-Sharon
 
Hello Sharon,

You could always try System.Reflection.Assembly.GetCallingAssembly.Location
instead of System.Reflection.Assembly.GetCallingAssembly.CodeBase.
 
Hi Sharon

In the Install overriden method of your Installer class you can use
Context.Parameters which has an entry with the key assemblypath whose value
is the destination path of the file you are copying (your dll or exe file).

Regards
Reza
 
Back
Top