在哪里存储配置为一个简单的.NET应用程序? [英] Where to store configuration for a simple .NET application?

查看:134
本文介绍了在哪里存储配置为一个简单的.NET应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编程,我希望削减到只有一个简单的EXE文件+一些数据存储(XML比如)一个相当简单的应用程序。

I'm programming a fairly simple application which I want to cut to just one simple EXE file + some data storage (XML for example).

我的问题是关于配置文件。当把这些文件?我看到刚才一个EXE文件中的一些应用(uTorrent的,媒体播放器经典 - 我可以使用它们无需任何安装),但他们存储他们的配置在其他地方。如何实现这一目标?

My question is regarding configuration files. Where to put those files? I saw a few applications that have just an EXE file (uTorrent, Media Player Classic - I can use them without any installation), but they store their config somewhere else. How to achieve this?

您将如何处理这一情况?到底要努力实现我上面描述的东西,或者干脆使用配置文件和数据存储在同一目录下的EXE文件?

How would you approach such situation? Is it better to try to achieve the thing I described above, or simply use a configuration file and data storage in the same directory as the EXE file?

推荐答案

我想你想看看的应用程序设置。这是一个API,它允许您使用强类型的API来保存用户或应用程序设置。引擎盖下的设置是通过XML序列化存储。

I think you want to take a look at Application Settings. This is an API which allows you to save user or application settings using a strongly typed API. Under the hood the settings are stored via XML serialization.

此API适用于几乎所有类型的.NET应用程序,包括低权限单击一次版本。它确实找到磁盘上的适用于存储数据的地方工作,并完全从你隐藏它。它也有一个很好的图形界面集成到Visual Studio。

This API works with virtually every type of .Net application including low permission Click Once versions. It does the work of finding the place on disk appropriate for storing the data and completely hides it from you. It also has a nice GUI integration into Visual Studio.

这篇关于在哪里存储配置为一个简单的.NET应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆