access the calling user's config info from a dll?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

I am using C#. My WinForm project has a config file created by VS2005
containing some user scoped properties. It has setup as the config file as
follows:
<userSettings>
<MyNameSpace.Properties.Settings>
<setting name="MyProperty" serializeAs="String">
<value>"aaa"</value>
</setting>
</MyNameSpace.Properties.Settings>
</userSettings>

I can easily access the property value in a type-safe manner in my WinForm
via:
Properties.Settings settings =
MyNameSpace.Properties.Settings.Default;
MessageBox.Show(settings.MyProperty);

My WinForm uses some BO's from a dll. How can I access the config properties
from within the dll?

The class which contains the property specification is marked internal to
the WinForm exe.

I have read the helptext regarding ApplicationSettingBase and
ConfigurationManager classes. These are both new with .Net 2.0, so they most
be both current technologies. Neither sections of helptext refer to the
other. I can't understand what job each of them are trying to do, or how
they relate to each other.

If one wants to access the calling user's config info from a dll, which
facility should I be using?

thanks
Barry Mossman


.



Relevant Pages

  • Re: access the calling users config info from a dll?
    ... ApplicationSettings via the Application class. ... My WinForm project has a config file created by VS2005 ... I can easily access the property value in a type-safe manner in my WinForm ... My WinForm uses some BO's from a dll. ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: Configuring a library
    ... calling application set configuration items for your dll. ... replaces the need for the config file you describe. ... Your main application would likely have the settings in a config file. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Tricky ConnectionString/config file problem
    ... If a dll is loaded by an EXE, then the dll reads config information from ... > the actual path to the database when the connection was created. ... > .config file to work with the main app? ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Loading a dependent dll
    ... But if you are talking about Win32 dll, you cannot use the .config file to reference it. ... I suggest that put the dlls on the Biztalk folder, or creating a new folder and adding it to PATH environment variable; this is a restriction regarding how Windows loads native dlls ...
    (microsoft.public.biztalk.general)
  • ConfigurationManager question
    ... I also have a config file named MyAppName.dll.config (same as the output ... I have this dll installed in the gac and located in a specific folder on ... different solution, I get and call this method, I get "Object reference ...
    (microsoft.public.dotnet.languages.csharp)