0

I have a Windows form application that works fine on Windows 7, but when opened in Windows 10, image files using ResourceManager don't show up. Application is using .Net 3.5 framework. Following is a bit of code:

static readonly System.Resources.ResourceManager rm = new System.Resources.ResourceManager("ImageResources", Assembly.GetExecutingAssembly());

rm.GetObject("ImageName");

Following is the error:

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

Is it due to some kind of incompatibility or Windows 10 is somehow restricting ResourceManager class to use all those images?

FaizanHussainRabbani
  • 3,256
  • 3
  • 26
  • 46

2 Answers2

1

Try to check value of Environment.Version (with some MessageBox for example) on the target machine. If you get 4.0 then you need to change configuration file as was proposed by Dr. Stich. If you don't have configuration file then create it like described there: How to: Add an Application Configuration File to a C# Project

And change it content to something like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
  <supportedRuntime version="v2.0.50727" />
</startup>
</configuration>

Runtime version you can get on supportedRuntime Element page

Alexej Sommer
  • 2,677
  • 1
  • 14
  • 25
  • Is it due to .net framework incompatibility? ResourceManager not able to load properly due to this? – FaizanHussainRabbani May 12 '16 at 04:57
  • I can not be sure on a 100%, but if you check Environment.Version on target machine and get v4.0 (if you add in your code messagebox that show value of Environment.Version) then you can be sure that it cause of .net framework version compatibility – Alexej Sommer May 12 '16 at 05:11
0

This issue was eventually resolved by adding CultureInfo.CurrentCulture in rm.GetObject method parameter i.e.

rm.GetObject("ImageName", CultureInfo.CurrentCulture);
FaizanHussainRabbani
  • 3,256
  • 3
  • 26
  • 46