I need to add configuration information to the assembly itself without including its app.config file with it.
How can i do it?
EDIT:
I need something like this
string config = @"<?xml version='1.0' encoding='utf-8'?>
<configuration>
.
.
.
.
</configuration>";
Set this hardcoded string configuration as current assembly configuration
Configuration settings be it user or application settings have their default values “hardcoded” in the assembly by default. They can be overriden by including an app.config, or modifying user settings at runtime and saving to the user config file.
After creating project settings (in project properties and go to the “Settings” tab), a
Settingsclass is generated with static properties which will have the default value you configured.They are accessible throughout your assembly like so:
These default values can be overridden via the app.config:
To answer your question: You can omit including the app.config from your application deployment, the defaults that you provided when configuring the settings are hardcoded.
Edit:
Just noticed you actually want to read the entire app.config from your assembly.
A possible approach could be the following: