Installer classes and config files?

  • Thread starter Thread starter Bob Willer
  • Start date Start date
B

Bob Willer

I have a .NET Installer class that gets executed during my installation.
However, that installer class is reliant on an associated .config file. So I
have "MyClass.dll" that is a .NET Installer class. I also have a file
"MyClass.dll.config" that is deployed into the same destination directory.

By doing some testing and using reflection, I have confirmed that the
ExecutingAssembly is "MyClass.dll", and it is executing in the directory
where MyClass.dll.config lives. However, anytime I try to retrieve a value
from the config file, (for example using ConfigurationSettings.AppSettings),
I get an error telling me the section does not exist.

Does anybody have this working, or know of any issues or how to do this?

Thanks,
Bob
 
By default the config file of the executing assembly is used, also if a
dependent assemblie requests config file info. So lets say you have an exe
(app.exe) that uses a dll (lib.dll), you should have only 1 config file:
app.exe.config. Even if you want to retrieve settings from whitin the
lib.dll, the .NET Framework will look in the app.exe.config file (=executing
assembly).
 
Thanks Jan. Unfortunately, in this case it is an InstallShield .exe that
launches the .NET Installer class. Using
System.Reflection.Assembly.GetExecutingAssembly() returns me "MyClass.dll".
Any other thoughts?

BW
 
Back
Top