views:

137

answers:

2

I want to store configuration information about my DLL in an XML file inside my DLL i.e. if changes need to be made the DLL must be re-compiled.

The reason is because its a elegant format and I may not use config files for this DLL.

Any ideas? I literally want to be able to edit an xml in Visual Studio then compile it and only see a DLL in the output.

+5  A: 

Yup - include it as an Embedded Resource (i.e. use that setting in the Properties for the item in Visual Studio), then use Assembly.GetManifestResourceStream to read it.

I do this all the time for unit test data. As you say, you can just edit the file, rebuild, and it'll be there.

Jon Skeet
Thanks mate that helps a lot!
TheLearner
A: 

I wanted to make a small addendum to Jon's answer. Embedded Resource is the value of the Build Action property on the Properties panel.

Ax