简体   繁体   English

从文件路径中删除版本号

[英]Remove the version number from file path

I save the user settings with Properties.Settings. 我使用Properties.Settings保存用户设置。

Properties.Settings.Default.key = "value";
Properties.Settings.Default.save();

and here is the saved file: 这是保存的文件:

C:\Users\Me\AppData\Local\Me\MyCompany\0.0.1\user.config

How can I prevent that the version number is in the path, like that? 我该如何防止版本号出现在路径中?

C:\Users\Me\AppData\Local\Me\MyCompany\user.config

I have now found another way. 我现在找到了另一种方式。

After starting the program I let run the following code: 启动程序后,我运行以下代码:

if(Properties.Settings.Default.UpgradeRequired)
{
    Properties.Settings.Default.Upgrade();
    Properties.Settings.Default.UpgradeRequired= false;
    Properties.Settings.Default.Save();
}

UpgradeRequired is a user-specific property, the default value is true UpgradeRequired是用户特定的属性,默认值为true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM