Thursday, October 23, 2008

Load xsd file from assembly

First, you need to add xsd file to resource by changing build action to "Embedded Resource".
To access this file from code write something like:


XmlSchemaSet schemas = new XmlSchemaSet();
Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("Namespace.ServiceDescription.xsd");
schemas.Add("", XmlReader.Create(new StreamReader(stream)));

Submit this story to DotNetKicks

0 comments: