【发布时间】:2015-12-21 13:39:17
【问题描述】:
我有自定义配置部分,我可以正确阅读。现在我想要 Intellisense。
我创建了我的架构,首先创建一个只有我的配置部分的 XML,然后让 VS2013 为我生成架构文件。将其命名为 CustomConfig.xsd 并添加到我的项目中。我根据@stakx 在this SO item 中的回答更新了架构,所以它看起来像这样:
<xs:schema id="customConfigSchema"
targetNamespace="http://tempuri.org/customConfig.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/customConfig.xsd"
xmlns:mstns="http://tempuri.org/customConfig.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="customConfig">
<xs:complexType>
<xs:sequence>
<xs:element name="someElement">
<xs:complexType>
...
</xs:complexType>
</xs:element>
...
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
然后在我的app.config 中,我将架构详细信息添加到<customConfig>,如下所示:
<configuration>
<configSections>
...
<section name="customConfig" type="..." />
</configSections>
...
<customConfig xmlns="http://tempuri.org/customConfig.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema"
xsi:noNamespaceSchemaLocation="customConfig.xsd">
<someElement ... />
</customConfig>
</configuration>
保存所有内容,然后我尝试通过编辑<someElement> 对其进行测试,但没有智能感知。我错过了什么?
我可以看到,当我打开我的 app.config 并查看属性窗口时,架构将我的架构文件显示为勾选。所以我只能假设它从我的app.config 中获取模式属性。但是没有智能感知。
更新
我刚刚意识到我的 app.config 上根本没有 Intellisense。
【问题讨论】:
标签: c# intellisense custom-configuration