将属性设置定位到.net 3.5会引发错误

时间:2014-12-16 13:28:34

标签: c# visual-studio-2013 .net-3.5 settings

我将我的项目之一转换为.net framework 4.5到3.5(VS2013 IDE),使其与Windows XP操作系统兼容。

的问题:

项目在onload事件中加载来自' project.property.settings的一组值,并抛出错误:

An unhandled exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll

Additional information: An error occurred creating the configuration section handler for userSettings/Installer.Properties.Settings: Could not load file or assembly 'System, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.

InnerException: When using relative path, make sure the current directory is correct.
InnerException:Verify that the file exists in the specified location

我在网上搜索了这个问题,但在这个项目中没有任何作用,我也在app.config文件中将版本更改为3.5.0.0。

app.config文件

<configuration>
    <configSections>
        <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <section name="Installer.Settings1" type="System.Configuration.ClientSettingsSection, System, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
            <section name="Installer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
        </sectionGroup>
    </configSections>

程序在settings.designer.cs中执行以下编码时抛出上述错误

public string c0 {
            get {
                return ((string)(this["c0"]));
            }
            set {
                this["c0"] = value;
            }
        }

0 个答案:

没有答案