找不到适合指定区域性的任何资源(资源文件中的 C# WinForm 图像) [英] Could not find any resources appropriate for the specified culture (C# WinForm Images in Resource File)

查看:23
本文介绍了找不到适合指定区域性的任何资源(资源文件中的 C# WinForm 图像)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将三个图像添加到名为 Resource1.resx 的文件中.我还添加了一个字符串仅用于测试目的.我在 GetString 或 GetObject(image-name) 上收到此错误.

I added three images to a file called Resource1.resx. I also added one string just for test purposes. I'm getting this error on either the GetString or the GetObject(image-name).

{"找不到任何资源适用于特定文化或中立文化.确保\"Resource1.resources\" 正确嵌入或链接到程序集中\"TFBIC.RCT.Monitor\" 在编译时,或者所有附属程序集required 是可加载且完全的签名."}

{"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"Resource1.resources\" was correctly embedded or linked into assembly \"TFBIC.RCT.Monitor\" at compile time, or that all the satellite assemblies required are loadable and fully signed."}

    // get initial images 
ResourceManager rm = new ResourceManager(
    "Resource1",System.Reflection.Assembly.GetExecutingAssembly());
CultureInfo ci = Thread.CurrentThread.CurrentCulture;


string strTest = rm.GetString("String1");  // just testing 

Bitmap bmCircleGreen = (Bitmap)rm.GetObject("circleGreen");      
Bitmap bmCircleYellow = (Bitmap)rm.GetObject("circleYellow");      
Bitmap bmCircleRed = (Bitmap)rm.GetObject("circleRed");  

我的表单是我项目中的第一个类(我已经看到了那个错误).
我为我的项目分配了一个强键但无济于事.
不知道还能尝试什么.

My form is the first class in my project (I've already seen that error).
I assigned a strong-key to my project to no avail.
Not sure what else to try.

推荐答案

您是否记得在引用资源时包含默认命名空间/文件夹?

Have you remembered to include the default namespace/folder when you reference the resource?

ResourceManager rm = new ResourceManager("DefaultNamespace.Folder.ResourceName");

如果您不确定正确的名称,请在 Reflector 中加载程序集并向下浏览以查看它是什么.

If you are unsure of the correct name, load the assembly in Reflector and browse down to see what it is.

这篇关于找不到适合指定区域性的任何资源(资源文件中的 C# WinForm 图像)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆