我收到未声明Element的警告 [英] I get a warning that Element is not declared

查看:197
本文介绍了我收到未声明Element的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我对xml还是很陌生,但是我的网站目前对此有要求.
我使用StructureMap
我想创建一个StructureMap.config
这是我的代码:

Hi,
I am pretty new to xml , but my site currently demands for it.
I use StructureMap
And i wanted to create a StructureMap.config
Here is my code :

<?xml version="1.0" encoding="utf-8"?>
<StructureMap>
  <Assembly Name="Liaison.Common"></Assembly>
  <Assembly Name="Liaison.Components"></Assembly>
  <Assembly Name="Liaison.DataAccess"></Assembly>
  <Assembly Name="Liaison.Liaison"></Assembly>
</StructureMap>




< structuremap>标签以蓝色下划线,并给我这样的警告:
未声明"StructureMap"元素.

我为此使用了Visual Studio.
有人帮我解决这个问题.

谢谢.




the <structuremap> tag get underlined in blue color and it gives me warning like this:
The ''StructureMap'' element is not declared.

Im using Visual Studio for this.
Someone help me with this.

Thank you.

推荐答案

标记以蓝色下划线,并给我这样的警告:
未声明"StructureMap"元素.

发生这种情况是因为您试图将其添加到配置文件中.如果这是一个保存为* .xml文件的平面XML文件,那么一切都会很好.
配置文件具有标准格式和要显示的已定义元素.


对于您的情况,我们需要在Configuration标签内进行:
将StructureMap配置嵌入到App.config文件中 [ ^ ]
样本:
the tag get underlined in blue color and it gives me warning like this:
The ''StructureMap'' element is not declared.

This is happening because you are trying to add it in a Config file. Has this been a plane XML file saved as *.xml file, all would be good.
Config files have standard format and defined elements to show.


For your case, we would need to do it inside Configuration tag:
Embedding StructureMap configuration into the App.config file[^]
Sample:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="StructureMap" type="StructureMap.Configuration.StructureMapConfigurationSection,StructureMap"/>
  </configSections>
  <StructureMap>
     <Assembly Name="Liaison.Common"></Assembly>
     <Assembly Name="Liaison.Components"></Assembly>
     <Assembly Name="Liaison.DataAccess"></Assembly>
     <Assembly Name="Liaison.Liaison"></Assembly>
  </StructureMap>
</configuration>


此处的文档详细信息: StructureMap-StructureMap主页 [


Documentation details here: StructureMap - StructureMap Home Page[^]


这篇关于我收到未声明Element的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆