[英]Not getting VS2013 Intellisense for custom config even with schema defined
我有自定义配置部分,我可以正确阅读。 现在我想要Intellisense。
首先通过仅使用config部分创建XML,然后使用VS2013为我生成Schema文件,从而创建了架构。 将其命名为CustomConfig.xsd
并添加到我的项目中。 我在此SO项目中基于@stakx的答案更新了架构,因此看起来像这样:
<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>
进行测试,但是没有Intellisense。 我想念什么?
我可以看到,当我打开app.config
并查看“属性窗口”时,这些模式将我的模式文件显示为选中状态。 因此,我只能假定它正在从我的app.config
拾取架构属性。 但是没有Intellisense。
更新
我只是意识到我根本没有在我的app.config
上得到Intellisense。
我在VS2015上打开了我的解决方案,它为我的自定义配置提供了Intellisense。
然后我在VS2013上注意到,由于某种原因,默认情况下不使用DotNetConfig.xsd
。 VS2015并非如此。 当我在VS2013上勾选它以便使用时,用于我的自定义配置的Intellisense开始起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.