[英]Not getting VS2013 Intellisense for custom config even with schema defined
I have custom config section which I can read correctly. 我有自定义配置部分,我可以正确阅读。 Now I wanted Intellisense for it.
现在我想要Intellisense。
I have created my schema by first creating an XML with only my config section, and then got VS2013 to generate the Schema file for me. 首先通过仅使用config部分创建XML,然后使用VS2013为我生成Schema文件,从而创建了架构。 Named it
CustomConfig.xsd
and added to my project. 将其命名为
CustomConfig.xsd
并添加到我的项目中。 I updated the schema based on @stakx's answer in this SO item , so it looks like this: 我在此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>
Then in my app.config
I added the schema details to <customConfig>
, like this: 然后在我的
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>
Saved everything, then I tried to test it by editing <someElement>
, but there is no Intellisense. 保存所有内容,然后尝试通过编辑
<someElement>
进行测试,但是没有Intellisense。 What am I missing? 我想念什么?
I can see that when I open my app.config
and view the Property Window, the Schemas show my schema file as ticked. 我可以看到,当我打开
app.config
并查看“属性窗口”时,这些模式将我的模式文件显示为选中状态。 So I can only assume it is picking up the schema attribute from my app.config
. 因此,我只能假定它正在从我的
app.config
拾取架构属性。 Yet no Intellisense. 但是没有Intellisense。
UPDATE 更新
I just realised I do not get Intellisense at all on my app.config
. 我只是意识到我根本没有在我的
app.config
上得到Intellisense。
I opened my solution on VS2015, and it gives me Intellisense on my custom config. 我在VS2015上打开了我的解决方案,它为我的自定义配置提供了Intellisense。
Then I noticed on my VS2013, for some reason, does not use the DotNetConfig.xsd
by default. 然后我在VS2013上注意到,由于某种原因,默认情况下不使用
DotNetConfig.xsd
。 This was not the case on VS2015. VS2015并非如此。 When I ticked it on VS2013 so it is used, Intellisense for my custom config started working.
当我在VS2013上勾选它以便使用时,用于我的自定义配置的Intellisense开始起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.