Embed xsd in C# project

  • Thread starter Thread starter David
  • Start date Start date
D

David

Hello,
I'm using an xml schema (xsd file) to validate input xml. This xsd is
used by the C# dll and must be distributed with it. The xsd isn't
modified. So I would like to embed it in the DLL so that I don't have to
worry about the path where the file is stored... How do I embed the xsd
file into my DLL? I know how to get the file back from resource using
Assembly.GetExecutingAssembly() and
assembly.GetManifestResourceStream(...) but I don't know how to create
the resource.

Thanks,
David.
 
David said:
Hello,
I'm using an xml schema (xsd file) to validate input xml. This xsd is
used by the C# dll and must be distributed with it. The xsd isn't
modified. So I would like to embed it in the DLL so that I don't have to
worry about the path where the file is stored... How do I embed the xsd
file into my DLL? I know how to get the file back from resource using
Assembly.GetExecutingAssembly() and
assembly.GetManifestResourceStream(...) but I don't know how to create
the resource.

IN VS, select the file to be embedded in the Project Explorer. Look now
to the Properties window, and change the "Build Action" to Embedded
Resource.

Voila!! :-)

Chris
 
Back
Top