问题描述
我正在VS 2010中处理xml和xsd文件,但是intellisense不起作用.但是,Intellisense在VS 2008中可以处理相同的文件.
I am working on xml and xsd files in VS 2010 but intellisense isn't working. Intellisense is working for the same files in VS 2008, however.
当我键入'< xs:'时,不会出现诸如属性","complexType","simpleType"或"element"之类的选项.
When I type '<xs:' options like "attribute", "complexType", "simpleType", or "element" do not appear.
我想念的VS 2008和VS 2010之间是否有区别?
Is there some difference between the VS 2008 and VS 2010 that I'm missing?
我将xsd文件添加到解决方案中.所有适当的名称空间都是这样自动生成的:
I add an xsd file to my solution. All the proper namespaces are generated automatically as such:
<?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>
"xsdschema.xsd"位于"C:\ Program Files \ Microsoft Visual Studio 10.0 \ xml \ Schemas"目录中.
The "xsdschema.xsd" is in the "C:\Program Files\Microsoft Visual Studio 10.0\xml\Schemas" directory.
"XML模式"对话框的使用"列中有一个复选标记.
There is a check mark in the "Use" column in the XML Schemas dialog box.
推荐答案
我发现了发生了什么. Visual Studio 2010从Visual Studio 2008导入了架构.这会导致重复警告,如下所示:
I discovered what happened. Visual Studio 2010 imported the schemas from Visual Studio 2008. This caused duplication warnings like the one below:
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
在"XML模式"对话框中,我从模式缓存中删除了旧版本.您必须重新启动Visual Studio.
In the XML Schemas dialog, I removed the old ones from the schema cache. You'll have to restart Visual Studio.
这篇关于XML/XSD智能感知无法在Visual Studio 2010中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!