Click here to Skip to main content
15,503,177 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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
<?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>



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.
Posted
Updated 26-May-12 8:00am
v2

1 solution

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
<?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>

Documentation details here: StructureMap - StructureMap Home Page[^]
 
Share this answer
 
Comments
Sipherz 31-May-12 8:55am    
Thank you,
But when i have done doing that
I get a message "Could not find schema information for the element StructureMap" what do i do now

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900