Stewart Alan
Stewart Alan

Reputation: 1643

Accessing XSD file as embedded resource in Windows Forms application

I have an XSD called SystemData.xsd which has its build action set to Embedded resource. In my Form, in the Load event, I am calling

this.assembly = Assembly.GetExecutingAssembly();

Then I am attempting to get the resource thus:

StreamReader schemaStream = new StreamReader( this.assembly.GetManifestResourceStream( "DataCaptureTool.UI.SystemData.xsd" ) );

Which is not returning anything. Am I doing this correctly? And if so, is the issue likely to be that I'm referencing the fully qualified namespace of the resource incorrectly? How can I check what this is?

Thanks

Stewart

Upvotes: 2

Views: 1968

Answers (1)

akton
akton

Reputation: 14386

If you are having issues finding embedding resources, open the assembly in ILDASM, open the manifest and look for ".mresource" sections. These are your embedded resources. Check that you are looking for the resource using the correct name.

If you cannot find it, you have not embedded the file. Check that the "Build Action" in the properties window is "Embedded Resource".

Upvotes: 2

Related Questions