简体   繁体   English

Properties.Settings.Default加载先前的项目值

[英]Properties.Settings.Default loads previous project value

I copied a version 4.1 project (VS2008) to a version 5.0 project (VS2013) and renamed all text values from 4.1 to 5.0. 我将4.1版项目(VS2008)复制到5.0版项目(VS2013),并将所有文本值从4.1重命名为5.0。 In the settings designer (Project -> 'ProjectName' properties) there is a setting named ProjectName. 在设置设计器(Project->'ProjectName'属性)中,有一个名为ProjectName的设置。 This was changed to 'AppName_5.0'. 这已更改为“ AppName_5.0”。

In our 'About' screen, this setting is loaded and displayed on a label. 在我们的“关于”屏幕中,此设置已加载并显示在标签上。 However, in debug mode, the about screen keeps displaying 'AppName_4.1'?? 但是,在调试模式下,“关于”屏幕将继续显示“ AppName_4.1”?

label1.Text = Properties.Settings.Default.ProjectName; //Displays 4.1?

I don't understand where this value keeps coming from? 我不明白这个价值从何而来? In the AppName_5.0.exe.config file, the value is AppName_5.0? 在AppName_5.0.exe.config文件中,该值为AppName_5.0?

.config also stored in %localappdata%\\yourApp .config也存储在%localappdata%\\ yourApp中

found here 这里找到

I've noticed this happening on some projects when the .config file and the project settings are out of sync - try going to the project's properties, under the Settings tab. 我注意到某些项目在.config文件和项目设置不同步时会发生这种情况-尝试转到“设置”选项卡下的项目属性。 This should prompt you to load the values from the .config file. 这应该提示您从.config文件中加载值。

显然,我们使用的是CustomSettingsProvider,它将设置文件存储在另一个位置...:-/

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

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