Smart client deploy question

A

AutoTrackerPlus

I have a .Net 2005 windows application. In a method, I do the following to
load an XML file..

System.Xml.XmlDocument singleFax = new System.Xml.XmlDocument();

singleFax.Load(Path.Combine(Application.StartupPath, NameOfFile.xml));





The XML file I load in the code above needs to be installed with the
apllication... how do I add the XML file to the deploy? Right now, I just
use the "Publish Now" feature by selecting properties and clicking the
"Publish" tab in the project file... I'm just not sure how to add this file
(the XML file) to the deployment "package".





Thanks in advance!





Brian
 
M

Marc Gravell

In project properties, go into the Publish tab and select Application
Files...; now ensure that your file is marked "Include (Auto)" or
"Include"

If it doesn't appear, try marking it as "Content" in the solution
explorer..

Marc
 
R

RobinS

Also, in the properties for the file in the Solution Explorer, mark it as
"copy always".

Make sure in the Application Files that is marked Include, and not as a data
file. If it is a data file, it will put it in a separate area when it
deploys it. This is the default for xml files, so you have to change it.

RobinS.
 
A

Andrej Tozon

I'd say when dealing with data/conent files it's better to compile
them as "data files" and use DataDirectory instead of StartupPath to
load them. Just to keep application and data files separate.

Andrej
 
R

RobinS

I'd say it depends on what is in the XML file. For example, we have menu
options in an XML file. They don't change, they aren't updated when the
application runs. These should be deployed as part of the application.

If you were persisting XML with datasets, or a SQLServer database, or
something like that, I could see it. But the OP's file seems to be a
configuration-type file. I stand by my assertion.

RobinS.
 

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