Solved

How Do You Read a XML File from a Visual Studio Project?

Posted on 2014-07-29
3
581 Views
Last Modified: 2014-09-05
I need to read a XML file loaded into a Visual Studio Project.  How do you read the XML file from the Visual Studio project files?

Thanks,

Dan
0
Comment
Question by:danielolorenz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 33

Expert Comment

by:ste5an
ID: 40226707
Drag it into your solution. Set the properties BuildAction=Content and Copy to Output Directory=Copy always. Then you can simply read it by e.g.
static void Main(string[] args)
{
  XDocument document = XDocument.Load(@"MyDocument.xml");            
  Console.ReadLine();
}

Open in new window

0
 
LVL 1

Accepted Solution

by:
karthickj25 earned 500 total points
ID: 40226716
Are you trying to read .xml files added to project, or files with .proj extension?
0
 

Author Closing Comment

by:danielolorenz
ID: 40306156
Thanks
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question