XML/XSD intellisense在Visual Studio 2010中不起作用

Jas*_*son 6 xml intellisense xsd visual-studio-2010

我正在研究VS 2010中的xml和xsd文件,但智能感知不起作用.但是,Intellisense正在为VS 2008中的相同文件工作.

当我输入"<xs:"选项时,如"属性","complexType","simpleType"或"element"不会出现.

我错过的VS 2008和VS 2010之间有什么区别吗?

我在我的解决方案中添加了一个xsd文件.所有正确的命名空间都是自动生成的:

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="XMLSchema2"
    targetNamespace="http://tempuri.org/XMLSchema2.xsd"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/XMLSchema2.xsd"
    xmlns:mstns="http://tempuri.org/XMLSchema2.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

</xs:schema>
Run Code Online (Sandbox Code Playgroud)

"xsdschema.xsd"位于"C:\ Program Files\Microsoft Visual Studio 10.0\xml\Schemas"目录中.

XML Schemas对话框的"Use"列中有一个复选标记.

Jas*_*son 10

我发现了发生的事.Visual Studio 2010从Visual Studio 2008导入了模式.这导致了重复警告,如下所示:

Warning The global attribute 'http://www.w3.org/XML/1998/namespace:lang' has already been declared. C:\Program Files\Microsoft Visual Studio 10.0\xml\Schemas\xml.xsd   
Run Code Online (Sandbox Code Playgroud)

在XML Schemas对话框中,我从架构缓存中删除了旧的.您必须重新启动Visual Studio.