How do you embed app.config in C# projects?

Aha. I guess you’re falling foul of Visual Studio automatically placing stuff in configuration that you DONT want configured by the end user.

In this case use resources. Simply add a new file of type .resx. With this you’ll be able to add things like strings and images to the resource file. After you build this it should provide static access to the resources (it typically generates a code file from the resources for you so you don’t have to access ResourceManager yourself).

E.G. If I made resources.resx with a string called MyConfigValue after a build I should be able to access this like:

textBox.Text = Resources.MyConfigValue;

If you want values that are kinda variable but shouldn’t be configurable then this is the right place to put them.

HTH.

Leave a Comment