Skip to main content

Posts

Showing posts with the label XML

The type 'System.Xml.IXmlLineInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'

I have been getting this weird exception out of nowhere while compiling my solution. Turns out I had two projects in my solution using different System.Xml assembly. One using straight from .NET Framework 2.0 and other using assembly 2.0.5.0. ( from Silverlight runtime). Referenced path were C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll & C:\Program Files\Reference Assemblies\Microsoft\Framework\Silverlight\v4.0\System.Xml.dll respectively. If a project file does not specify the exact reference assembly, compiler tries to use any matching assembly present in its cache. I could see the following reference in my csproj file. <Reference Include="System.Xml"/> I updated this reference with the correct version (along with the PublicKeyToken and Culture info) and made the SpecificVersion=True, enforcing compiler to use the specified assembly <Reference Include="System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934...

Schema Import using XSD tool

We are all aware of XSD tool that comes along the Visual Studio 2005. We all might have used it to generate classes and dlls using this tool from xsd schemas. In order to use schemas that import other schemas using xs:import , we need to specify both the base schema and the imported schema on the command line.As the XSD tool doesn't seem to understand schemaLocation attribute . Just mentioning the import tag won't import the schema while creating classes. So the correct usage of xsd.exe would be xsd.exe ImportingSchema.xsd ImportedSchema.xsd {options}