[Mono-list] ResourceManager

Julien Sobrier julien at sobrier.net
Wed Nov 16 23:52:15 EST 2005


Kornél Pál wrote:
> I suggest however to use the constructor that takes a string (resource
> name)
> and an assembly (that contains the resource).
> 
> Kornél

Thank you.

I've made some progress, but I still have some issues.

I embedded a file as a resource. The name of the resource is
sample.MediaInfoDB.sql

I checked the name using this code:

// Get this type's assembly
Assembly assem = this.GetType().Assembly;

// Enumerate the assembly's manifest resources
foreach (string resourceName in assem.GetManifestResourceNames())
{
    Console.WriteLine("resource: " + resourceName);
}

It displays: "resource: sample.MediaInfoDB.sql"


But then, I cannot access it:

ResourceManager rm = new ResourceManager("sample",
Assembly.GetExecutingAssembly());

Object file = rm.GetObject("MediaInfoDB.sql"); // same issue with
sample.MediaInfoDB.sql

At runtime, the method GetObject returns the exception
MissingManifestResurceException: Could not find any resource appropriate
for the specified culture or its parents. Make sure "sample.resources"
was correctly embedded or linked into assembly "Database".

Any idea why it is failing?


Thank you
Julien


More information about the Mono-list mailing list