Hello, I am creating an assembly using Reflection.Emit. In the assembly I create also a class deriving from System.Windows.Forms.Form which uses resources. The resources live in a .resource file, which I want to embed into the assembly using ModuleBuilder.DefineResource(...) as in the following code snippet:
IResourceWriter resourceWriter = theModuleBuilder.DefineResource( theTypeBuilder.FullName + ".resources", "Resources", ResourceAttributes.Public ); IResourceReader reader = new ResourceReader( resourceFileName ); IDictionaryEnumerator en = reader.GetEnumerator(); while( en.MoveNext() ) { string name = en.Key.ToString(); resourceWriter.AddResource( name, en.Value ); } In the winform class I create, I try to access the resources using code equivalent to this c# snippet (this is code generated by the forms designer): System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1)); ... this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); but the GetObject fails with MissingManifestResourceException. Any ideas? Using ILDASM I see no apparent differences between my assembly and a c#-generated assembly. Thanks, --rene ------------------------- Rene G. Rodriguez ASNA - AVR Lead Developer