Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a solution with an executable project and several DLL projects. There are system-wide parameters (file names, locations, numeric constants) that should be visible to everyone. (I expect to maintain them in an XML file with XmlTextFile.)

What I have tried:

I tried placing a class (Locale) in the executable project, but it was not visible to the DLL projects. I tried making references (and "using") in the DLL projects but this was rejected. I currently have the Locale class in an arbitrary DLL project and use references (with "using") in the other projects. This works but seems clumsy, and the executable project cannot refer to it (which is awkward and clunky--it needs to refer to these parameters too). I tried letting the executable refer to it, but this was rejected as "circular" (which it was of course). I would like to find a clean way to make these configuration parameters visible throughout the system. Thanks!
Posted
Updated 24-Jul-21 3:17am
Comments
Richard MacCutchan 24-Jul-21 8:48am    
Are these values required at compile time or runtime? If the former, then you could have a source class that each project can include. If at run time then you need some way to pass them in to each DLL, which is a bit more of an issue.
TomFuller 28-Jul-21 12:54pm    
Thanks for answering! Some are compile time, some are runtime. The following answer though appears to work for both.

1 solution

One simple solution is to create a Locale project and have everything that needs to access it reference that.

Make it a static class and off you go.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900