Other than using raw XML, is there an easy way in .NET to open and read a config file belonging to another assembly...? I don't need to write to it, just grab a couple of values from it.
Add the App. config file to your project. After creating a . NET Framework project, right-click on your project in Solution Explorer and choose Add > New Item. Choose the Application Configuration File item and then select Add.
These config files are typically placed under separate root directory than the rest of application code. For example, in case of Java they are typically under src/main/resources .
The Visual Web Developer program built-in to Visual Studio is used to open and edit this CONFIG file. The Notepad program in Windows works just fine for viewing, editing, and even creating text-based configuration files like this.
Here's MSDN on OpenExeConfiguration.
Edit: link to a how-to on eggheadcafe.com disappeared. Looks like EggheadCafe moved to NullSkull but dropped the article ID's.
Have you tried ConfigurationManager
and OpenExeConfiguration(path)
? (in System.Configuration.dll)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With