views:

350

answers:

1

In VC6 I had a large application linking with some DLLs and a static library "sharedlib". Each DLL would also link with this library.

The app had its own resources, the DLLs had their own resources, and the static library also had its own separate resources. Of course I had to ensure that the static lib's resource IDs didn't clash anywhere else in the system, but it did work.

(my reason for doing this - I had a custom control that was used in my application and every DLL. The control had a couple of bitmaps overlayed onto it)


Now I'm working on a brand new application in C++/CLI and I've noticed that this doesn't work with managed resources.

For example I added an empty form to my library. If I create an instance of the form from the application ("xxxapp") and display it like this, it works fine:

sharedlib::testform^ form = gcnew sharedlib::testform();
form->ShowDialog();

If I now add a PictureBox control to the form, and point it at a .bmp file, when the form gets displayed the application crashes with the following exception:

An unhandled exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "sharedlib.testform.resources" was correctly embedded or linked into assembly "xxxapp" at compile time, or that all the satellite assemblies required are loadable and fully signed.


So why can't I have managed resources in a static library? Would any of the baffling array of manifest/resource related project settings allow this to work? Do you know of a workaround?

(I know I could change from .lib to .dll but I'd prefer not to do that)

A: 

I wonder if you found an answer to this problem?

Regards, Neil.

Neil B
Nope, changed from .lib to .dll. Sorry :(
demoncodemonkey