Actually, you can use an app.config file. You just have to use the one
that is associated with the EXE (if there is one). There is nothing that
says that libraries can't use application configuration files, it just
doesn't make sense to have a separate file outside of the application
configuration one.
This is actually the preferred method of using config files. Look at
all the application blocks from MS. IIRC, while they use separate files,
they still are referenced to those separate files from the main app.config
file. Having a separate file which stands ^on it's own with nothing
referencing it^ is not a good thing, as it decentralizes the logical
container for your applciation settings.
What developers need to realize is that even though they are developing
libraries in some cases, those libraries ARE NOT THE APPLICATION.
Therefore, don't assume that you should have your own settings. Rather, let
the person who is putting their application together put their settings
where they would most likely expect it, in the app.config file.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:uD**************@TK2MSFTNGP02.phx.gbl...
Hi,
As both projects are libraries (which becomes .DLL) you cannot use an
app.config file.
When I have done in escenarios ilke this is to keep the settings in a file
that I expect to be found in the same folder than the dll. You create a
class with static members and constructor, it's the constructor the one
that load & process the file. Now the issue is that you need to manually
process the file yourself. Not a big deal though.
Take a look at opennetcf.org they provide a similar mechanism of Config
than the full framework.
"t f" <th**********@gmail.comwrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...
>Hi
Okay this should be a simple one...
In my solution i have 2 projects (one class library and one control
library) - they both share the name default namespace - question is I
want to be able to have settings persist for both librarys but have it
contained in one settings files (this is in the class library as the
control library uses the class library)...
i tried the following in the control library
global::mynamespace.Properties.Settings.Default.x xx
but it is inaccessible due to its protection level... how do i make it so
that the librarys share the same Settings?
is it impossible? if so should i just make a static class which returns
the value?
thanks
t f