I'm sure this is a pretty basic question with an easy answer but I'm a C# beginner and I'm struggling with it...
I've added an XML fragment to my solution and I've noticed that the file is copied into the bin/debug folder and gets copied into bin/release when I do a build. I have the "Copy To Output Directory" property set to Copy Always.
How can I actually read from this file in code using a path that will work in debug mode and when the assembly is shipped?
I need to do something like:-
where "MyXMLFileFragment.xml" is the file I have added to the solution but I don't know how to specify a path so that it will be picked up from the solution in debug and when built. Can anyone help me?
I've added an XML fragment to my solution and I've noticed that the file is copied into the bin/debug folder and gets copied into bin/release when I do a build. I have the "Copy To Output Directory" property set to Copy Always.
How can I actually read from this file in code using a path that will work in debug mode and when the assembly is shipped?
I need to do something like:-
Code:
string sXMLFragmentTemplate = System.IO.File.ReadAllText(@"MyXMLFileFragment.xml");
where "MyXMLFileFragment.xml" is the file I have added to the solution but I don't know how to specify a path so that it will be picked up from the solution in debug and when built. Can anyone help me?