Thanks Jb, In Silver Light the XAML files are added to a .resources file named <assemblyname>.g.resources. This .resources file contains the binary version of the XAML files (BAML).
The problem is I am able to iterate through the resources' file but not able to add a new entry to it.Also because the ModuleDefinition.Resources property is ReadOnly I cannot set a Resource Collection to it. SrcK. On Feb 15, 12:41 pm, Jb Evain <[email protected]> wrote: > Hi, > > On Wed, Feb 15, 2012 at 7:47 AM, srcKode <[email protected]> wrote: > > foreach (EmbeddedResource eres in > > Source.Module.Resources.OfType<EmbeddedResource>()) > > Target.Module.Resources.Add(eres); > > As a general advice, it's better to clone objects instead of moving > Cecil objects from one module to another. You should use: > > foreach (var resource in > Source.Module.Resources.OfType<EmbeddedResource>().Select(r => new > EmbeddedResource(r.Name, r.Attributes, r.Data)); > > > in both the cases the resources get added but I am not able to add the > > resource to the existing name.g.resources. > > I'm afraid I don't know what a name.g.resources is, or what gets into > it. It's specific to SL, so there's nothing in Cecil to manipulate it > for you. > > Based on the name, I assume it's some kind of resource, so you can > definitely read it with Cecil, and modify or recreate a resource in > your target module. > > Jb -- -- mono-cecil
