I ran into a peculiar behavior that Visual Studio 2008 was exhibiting today that I suspect is a bug. If it's not a bug, then there must be a setting somewhere of which I'm not aware.
I have a couple of projects that I've developed initially in VS2003 (targeting the .NET 1.1 framework), maintained in VS2005 (targeting the .NET 2.0 framework), and recently upgraded to VS2008 (targeting the .NET 3.x framework). These projects, rather than embedding image resources natively (that is, embedding the .png, .gif, and .jpg files as independent resources) I have some .resources files that contain string and image data. Up to this point they've worked great.
However, I discovered today that once upgraded to VS2008 the resources were not loading. My code for loading the resources is pretty simple:
ResourceManager mgr = new ResourceManager("MyApp.Res", Assembly.GetExecutingAssembly());
ResourceSet res = mgr.GetResourceSet(CultureInfo.InvariantCulture, true, false);
Note that my embedded resource file is named 'Res.resources', so the namespace for the ResourceManager is my application namespace followed by 'Res' because it's in the root of the application.
Now, with VS2008, the mgr.GetResourceSet() call was returning a NULL value. Somehow my resources were not resolving! After digging a bit, I found that the '.resources' extension was being truncated off of my resource file during the embedding process so though it was present in the .exe, it's name didn't have the '.resources' extension appended!
My solution was to rename the file 'Res.resources.resources' and it worked. Interestingly, the compiler doesn't exhibit this same behavior for the .resources files that it creates. Has anyone else run into this or is there a setting for it? Fortunately, I only lost about 15 minutes from discovering the issue to having it fixed, but it really feels like a hack more than a fix.