Pages

Saturday, 8 May 2010

Loading XML documents stored in the Output directory

I wanted to load an XML document that is distributed with my project.

// Load the XML State Transition Map
XmlDocument xmlStateMap = new XmlDocument();
xmlStateMap.Load(stateMapName);

I set the Copy to Output Directory property of the XML file to "Copy always". However the file never appeared in bin\debug. I also had to change the Build Action property from the default value of "Resource" to "Content" .

No comments: