How to get XML IntelliSense to work in VS 2015?

Visual Studio supports IntelliSense XML for Visual Basic (it offers the names of XML elements and attributes as you type). I am trying to use VS 2015 to update a project that I started several years ago in VS 2012 or 2013. The project uses XML, and I configured it to use XML IntelliSense. The project compiles for VS 2015 and works correctly, but XML IntelliSense does not work (element names are not offered).

To try to fix the problem, I created the following XML file (stored as Test.xml in My documents):

<?xml version="1.0" encoding="utf-8"?>
<Root xmlns="http://www.finetime.com">
    <Parent>
        <Child>Data</Child>
    </Parent>
</Root>

I created a new Windows Forms project with one button Button1in one form Form1and added the following XML schema to the project (the XSD file is shown in Solution Explorer):

<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.finetime.com" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.finetime.com">
  <xs:element name="Root">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Parent">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="Child" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

The code is Form1as follows:

Imports <xmlns:ft="http://www.finetime.com">

Public Class Form1
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim xmlPath As String = IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "Test.xml")
        Dim xmlDoc As XDocument = XDocument.Load(xmlPath)
        Dim root As XElement = xmlDoc.<ft:Root>.First
        Dim data As String = root.<ft:Parent>.<ft:Child>.Value
        MessageBox.Show(data)
    End Sub
End Class

The project compiles, starts and displays the “Data” MessageBoxat the click of a button, but the completion of the XML word does not occur.

For example, when I type Dim root As XElement = xmlDoc.<ft:, I would expect that a selection of XML element names will be displayed to complete the statement, but nothing appears. Am I missing a step?

+4
source share
1 answer

, XML Intellisense VB Roslyn (VS2015). MS Connect: https://connect.microsoft.com/VisualStudio/feedback/details/1085407/intellisense-not-working-with-xml-to-schema.

Kevin [MSFT] 14.01.2012 9:43 ,

. , VB IDE, . , .

- Visual Studio Kevin Pilch-Bisson

+3

Source: https://habr.com/ru/post/1619946/


All Articles