VS2010:将设置添加到settings.settings会导致app.config架构错误

发布于 2024-12-13 11:45:54 字数 2658 浏览 1 评论 0原文

设置添加到Settings.settings

在此处输入图像描述

导致 Visual Studio 2010创建一个 app.config 文件,并镜像其中的设置:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    [...snip...]
    <userSettings>
        <ContosoManagementSystem.Properties.Settings>
            <setting name="foo" serializeAs="String">
                <value>bar</value>
            </setting>
        </ContosoManagementSystem.Properties.Settings>
    </userSettings>
</configuration>

但是当 Visual Studio 执行此操作时,Visual Studio 会抱怨 Visual Studio 不知道 Visual Studio 做了什么:

找不到属性“名称”的架构信息。

什么给?


请注意 类似问题不适用于此问题

  • Visual Studio 2010 与 Visual Studio 2008
  • 接受的答案不起作用

有一些建议来更改 app.config 使用的架构

在此处输入图像描述

Visual Studio 默认架构为 C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig.xsd

我尝试将其更改为其他架构:

  • “C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig30.xsd”

    导致 VS 因 DotNetConfig30 本身而阻塞(复杂类型“configSection_section”已被声明。

  • "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig.xsd" "C :\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig30.xsd"

    导致 VS 因 DotNetConfig30 本身而阻塞(复杂类型“configSection_section”已被声明。

  • <代码>“C:\ Program Files(x86)\ Microsoft Visual Studio 10.0 \ xml \ Schemas \ DotNetConfig.xsd”“C:\ Program文件 (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig20.xsd" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig30.xsd" "C:\Program Files (x86) \Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig35.xsd"

    导致 VS 因 DotNetConfig30 本身而阻塞(复杂类型“configSection_section”已被声明。

如何使 Visual Studio 2010 不会因编辑时 Visual Studio 2010 执行的操作而给出错误Visual Studio 2010 中的某些内容。

Ian Boyd 正在恶化

Adding a setting to Settings.settings:

enter image description here

causes Visual Studio 2010 to create an app.config file, and mirror the settings in it:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    [...snip...]
    <userSettings>
        <ContosoManagementSystem.Properties.Settings>
            <setting name="foo" serializeAs="String">
                <value>bar</value>
            </setting>
        </ContosoManagementSystem.Properties.Settings>
    </userSettings>
</configuration>

But when Visual Studio does this, Visual Studio complains that Visual Studio doesn't know what Visual Studio did:

Could not find schema information for the attribute 'name'.

What gives?


Note the similar question that doesn't apply to this question:

  • Visual Studio 2010 vs Visual Studio 2008
  • accepted answer doesn't work

There some suggestions to alter the schemas used by app.config:

enter image description here

Visual Studio default schema to C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig.xsd

i've tried changing it to other schemas:

  • "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig30.xsd"

    causes VS to choke on DotNetConfig30 itself (The complexType 'configSection_section' has already been declared.)

  • "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig.xsd" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig30.xsd"

    causes VS to choke on DotNetConfig30 itself (The complexType 'configSection_section' has already been declared.)

  • "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig.xsd" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig20.xsd" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig30.xsd" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\xml\Schemas\DotNetConfig35.xsd"

    causes VS to choke on DotNetConfig30 itself (The complexType 'configSection_section' has already been declared.)

How do i make Visual Studio 2010 not give errors as a result of something Visual Studio 2010 did when i editing something in Visual Studio 2010.

Ian Boyd is getting aggravated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文