簡體   English   中英

即使定義了架構,也無法獲得VS2013 Intellisense的自定義配置

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM