Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deploying XML files with Application

Status
Not open for further replies.

Chance1234

IS-IT--Management
Jul 25, 2001
7,871
US
A little bit confused into the whole publishing/properties/build

I have a app which requires a xml file in a directory called "C:\testx\test.xml"

now what i have been playing about is on my app , there is a method that checks to see if this directory exists, if not creates the director and creates the xml file.

But looking into the publishing settings I am wondering if there is an easy/smoother way to do this.


Chance,

Filmmaker, gentleman and ROMAN!
 
sorry should of added, im currently looking at the clickonce deployment settings

Chance,

Filmmaker, gentleman and ROMAN!
 
Chance -

What are you trying to do with this XML file? Is it only to be used as a template? I am not sure if this will help, but I have done this with a text file before. I imagine it would work with XML. (Just checked, it will at least let you add it)

Anyways, what I've done before with this text file is added it to my project (Project --> Add New Item (or existing...)). You can then reference it from your app like this: @"somefile.txt".

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
You could also embed the xml file into the compiled dll as a resource. then reference the resource from code and create the directory/file if it doesn't exist.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
This is a part one of two apps.

Part one app reads a directory containing XML files

Part Two app writes XML files to the xml Directory.

So want to make sure on both apps that the folder actually exists.


Chance,

Filmmaker, gentleman and ROMAN!
 
Hm, I think you are on the right track. If it is a large-ish file I would probably include the file in the app, and figure out how to send it to the directory, just to save the app from building the XML string each time (if this is in fact how you are creating the file).

You could also do as Jason suggests.

Hope this helps,

Alex

Ignorance of certain subjects is a great part of wisdom
 
Or you can thank MS *shiver* for providing a few Environment variables such as Desktop, ApplicationData, CommonApplicationData, SystemFolder, and more.

string filepath = System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);


Using CommonApplicationData allows you to use the file between any user on the machine. (System Specific rather than User Specific)

 
Click one deploy is nice but in the final product are you actually going to use that ? I would recommend just adding a setup project to your current solution.

The setup project has a file system in it, you can view it by right clicking go to View and then File System.

You can add you project output in the "application folder", add a shortcut to the project output in the "User's desktop" and "user's programs menu" folder, and then finally add a folder to the file system that you want(right click select add special folder), and then add your xml to that folder. Make sure to add it to the build (right click hit properties select configuration manager and check it). Now you have a customized setup program, to which u can easily change later. Even add more screens, EULA agreements, change the images that are shown, etc....just my 2 cents.

 
Is the setup project availiable from express ? i cant see any referneces to it.

Chance,

Filmmaker, gentleman and ROMAN!
 
Im not totally sure at work i have full version so i cant check now but if it does it would prolly be in Other project types.... i could check when i get home.

 
I am thinking i might actually use a combination of the shudder that jurkmoneky mentioned and my original plan.



Chance,

Filmmaker, gentleman and ROMAN!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top