Adding XML files to a build

  • Thread starter Thread starter Kris Rockwell
  • Start date Start date
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
 
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 ?
 
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
 
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
 
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
 
Back
Top