Adding XML files to a build

K

Kris Rockwell

Hello,

I have added an XML file to my project. When I build the project I want the
XML file to be placed next to the exe file in the Bin folder. This is
important as I am updating the XML file as needed to affect the actual
application (it acts as a config file). How can I get the file to build with
the exe so that it is placed in the Bin folder?

Any help would be greatly appreciated.

Thanks,
Kris
 
A

Adam Nowotny

Kris said:
Hello,

I have added an XML file to my project. When I build the project I want the
XML file to be placed next to the exe file in the Bin folder. This is
important as I am updating the XML file as needed to affect the actual
application (it acts as a config file). How can I get the file to build with
the exe so that it is placed in the Bin folder?

Any help would be greatly appreciated.

Thanks,
Kris

According to documentation you need to set the "Build Action" in the properties
of a file to "Content".
Unfortunately...it doesn't work :D
Or am i missing something here ?
 
M

Mike Hildner

According to documentation you need to set the "Build Action" in the
properties
of a file to "Content".
Unfortunately...it doesn't work :D
Or am i missing something here ?

I couldn't get that to work either, just assumed I didn't know what I was
doing. As a work-around, my app creates a default xml config file if one
does not exist. Kind of ugly, but at least it can handle if the file gets
deleted.

Mike
 
K

Kris Rockwell

I tried marking it as Content, but I couldn't get that to work either. At
least I know it isn't just me!!

Kris
 
J

Jay B. Harlow [MVP - Outlook]

Kris,
Normally what I do is to add the file to the Setup project, then when I
deploy the app the XML file will be placed in the correct folder.

Of course when testing under VS.NET I would need to manually copy the file
to the bin folder.

NOTE: For the app.config file you add the app.config filed (named literally
app.config) to your VS.NET project root, VS.NET (both 2002 & 2003) will then
copy the file into your bin folder and name it correctly for your
exectuables name (myproject.exe.config).

Hope this helps
Jay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top