Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

Has anyone used the settings class?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Waldy - 02 Aug 2006 15:00 GMT
Hi there,
              I added a settings component to my .DLL so that I can read in
the configuration settings.  This created a DLLNAME.config file in the
output directory and everything seemed to be OK until I tried to deploy the
.DLL and then realised that no matter what I type in the .config file, the
.DLL always returns the default values.  The .DLL is going to be called from
a VB Script, so what should I be using for a .config file that can be simply
edited in notepad when it is deployed?
John Liu - 03 Aug 2006 02:44 GMT
Hi,

I'm not 100% following the question, but here's my shot.

.NET reads the AppConfig once for an AppDomain - then it caches the
values and stops reading them again.  So if you modify the config file
halfway don't expect the running application to suddenly be able to see
the new values.

By default, the config file is the name of the starting exe file +
".config" suffix.  You can see/change the config file in setting up
your AppDomain.  What this does mean though, is if you have two
executables A.exe and B.exe, both using DLLNAME.dll

Then you need by default A.exe.config as well as B.exe.config files.

Not sure if I managed to catch your question - I tried to cast a big
net :)
jliu - johnliu.net

> Hi there,
>                I added a settings component to my .DLL so that I can read in
[quoted text clipped - 4 lines]
> a VB Script, so what should I be using for a .config file that can be simply
> edited in notepad when it is deployed?
Waldy - 03 Aug 2006 11:39 GMT
Hi John,
            thanks for responding.  My issue is that the values in the
.config file are not used, it appears as though the values are compiled into
the .dll.  The .dll is instantiated via VB Script, so there is no
application as such.
Waldy - 03 Aug 2006 12:24 GMT
O.K.  It's the old application must be an .exe thing.  I created copied the
.config file from the output directory to the one where the application
(engine.exe) is that runs the VB Scripts and renamed it to engine.exe.config
and I get my modified settings.

> Hi John,
>             thanks for responding.  My issue is that the values in the
> .config file are not used, it appears as though the values are compiled
> into the .dll.  The .dll is instantiated via VB Script, so there is no
> application as such.
John Liu - 30 Aug 2006 01:51 GMT
The ApplicationConfiguration classes will always use the default config
file specified in your AppDomain.

AppDomain.CurrentAppDomain.SetupInformation.ConfigurationFile

If you want to specify in your own DLL where to retrieve the file, you
might need to create your own AppDomain within the dll, set it up to a
different Config file, then load your ApplicationConfiguration within
that AppDomain.

You'll need to make some cross-domain calls.  And it can look hairy...
(Actually I feel itchy thinking down this path already).

May want to re-think how you want to specify your config settings.

jliu

> O.K.  It's the old application must be an .exe thing.  I created copied the
> .config file from the output directory to the one where the application
[quoted text clipped - 6 lines]
> > into the .dll.  The .dll is instantiated via VB Script, so there is no
> > application as such.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.