开发者

How to publish applications dependent on external files

I have an application that uses an .xml file to load information about objects (Such as strings for name, location etc.. nothing too complicated).

Currently when i use the application the .xml file is stored in:

"/bin/debug" 

of my project folder.

If i was to release my application as a standalone .exe how would i go about ensuring the .xml is at a suitable location? For example the application creates the settings file on the Desktop by default but they decide to keep the application .exe in Documents.

What would be the best way to tackle this? Is there any way to save the .xml information to the application itself to remove the need for the .xml in the first place?

Hope开发者_如何学Cfully i've given enough information

Thanks


Do the contents of the XML file have to be changed after deployment? If so, I would simply include the xml in your config file, as application settings.

If not, consider using a resource file.


@Jamie, beware of keeping settings files disjunct from the application installation or locations such as ApplicationData/AppName. Keeping them on the desktop or in "random" storage places may allow your user to be forgetful and remove these files unwantingly.

I suggest app specific settings stay with the application or in a single central location and any user specific settings be stored in ApplicationData/AppName (ApplicationData and other Windows locations are available through Environment.GetFolderPath(Environment.SpecialFolder.xxxx) where "xxxx" is the Windows defined folder.


Have you looked into serializing the xml you are working with to an object?

Here is an example of what I am talking about:

http://msdn.microsoft.com/en-us/library/ms973902.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜