我想在我的Windows窗体应用程序中显示用户.CONFIG文件的位置,这样用户就可以很容易地找到它。
我理解路径是如何创建的,这要感谢:Can I control the location of .NET user settings to avoid losing settings on application upgrade?。
但是,如果发生这种更改,我宁愿不必在我的应用程序中构造路径,特别是如果有一个简单的方法来获取user.config文件的位置。
最佳答案
试试这个:
var config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoaming);
MessageBox.Show(config.FilePath);