总是提示以下错误:“/WebShop”应用程序中的服务器错误。
--------------------------------------------------------------------------------未能在给定的程序集中找到任何适合于指定的区域性(或非特定区域性)的资源。请确保已将“WebShop.default_WebShop.resources”正确嵌入或链接到程序集“WebShop”。 baseName: WebShop.default_WebShop locationInfo: <null> resource file name: WebShop.default_WebShop.resources assembly: WebShop, Version=1.0.1719.15571, Culture=neutral, PublicKeyToken=null 说明:
源码如下
this.rm = new ResourceManager("WebShop.default_WebShop", typeof(WebForm1).Assembly);this.rm.GetString("nogoods_InnerHtml");我已经将WebShop.default_WebShop.resources文件放在WebShop的bin目录下
--------------------------------------------------------------------------------未能在给定的程序集中找到任何适合于指定的区域性(或非特定区域性)的资源。请确保已将“WebShop.default_WebShop.resources”正确嵌入或链接到程序集“WebShop”。 baseName: WebShop.default_WebShop locationInfo: <null> resource file name: WebShop.default_WebShop.resources assembly: WebShop, Version=1.0.1719.15571, Culture=neutral, PublicKeyToken=null 说明:
源码如下
this.rm = new ResourceManager("WebShop.default_WebShop", typeof(WebForm1).Assembly);this.rm.GetString("nogoods_InnerHtml");我已经将WebShop.default_WebShop.resources文件放在WebShop的bin目录下
解决方案 »
- using (SqlConnection conn = new SqlConnection...是什么意思
- 关于ajax的
- 如何判断究竟是点了浏览器刷新按钮 还是 从上一个页面点击超链接跳转过来的?
- 不使用codeBehind怎么共享页面通用代码
- 选择Dropdownlist的选项时,如何使期成树型目录结构?
- 菜鸟:关于串行化的问题
- 一个客户端生成TextBox的问题,高手请进
- 关于session的问题,高手来帮帮忙
- 关于ASP.Net设置
- 谢谢大家的帮助,五一快乐!!!
- 可以将 F:\DIR 目录映射成 D:\dir1\dir 目录吗???
- Server.Transfer的问题~~~~~~~~~!!!!!!!!!!!!!?????????????
al /t:lib /c:en-GB /embed:gErrorMessage.gb.resources /out:ErrorMessage.GB.dllusing System.Resources;
using System.Reflection;
AssemblyName am = AssemblyName.GetAssemblyName(@"d:\gb\errormessage.gb.dll");
Assembly assem = Assembly.Load(am);
ResourceManager rm = new ResourceManager("ErrorMessage.GB",assem);
string str = rm.GetString("01.001.00001");
using System.Resources;
using System.Globalization;
using System.Threading;
using System.Reflection;namespace SystemFramework.Dictionary
{
/// <summary>
/// clsResourceManager 的摘要说明。
/// </summary>
public class Dictionary
{
private string DictKey="dictionary";
private string LanguageTag; private ResourceManager dictionary;
public Dictionary(string languageTag)
{
LanguageTag=languageTag;
LoadDictionary(Assembly.GetCallingAssembly());
//LoadDictionary(Assembly.GetExecutingAssembly());
} public Dictionary(Assembly dictionaryAssembly,string languageTag)
{
LanguageTag=languageTag;
LoadDictionary(dictionaryAssembly);
} public Dictionary(string resourceName,Assembly dictionaryAssembly)
{
dictionary=new ResourceManager(resourceName,dictionaryAssembly);
} private void LoadDictionary(Assembly dictionaryAssembly)
{
DictKey="dictionary" + "." + LanguageTag.ToLower();
string[] dictionaryNames=dictionaryAssembly.GetManifestResourceNames();
string dictionaryName="";
for(int i=0;i<dictionaryNames.Length;i++)
{
if (dictionaryNames[i].IndexOf(DictKey)>=0)
{
dictionaryName=dictionaryNames[i];
dictionaryName=dictionaryName.Substring(0,dictionaryName.Length-10);
break;
}
}
if (dictionaryName!="")
dictionary=new ResourceManager(dictionaryName,dictionaryAssembly);
else
dictionary=null;
} public string this[string name]
{
get
{
return dictionary.GetString(name);
}
}
}
}//一个多语言数据词典的资源文件管理的类,你参考一下吧!
//因有很多资源文件,数据词典资源文件的命名为***.dictionary.eng.resx等
项目->添加现有项->所有文件(*.*)->default_WebShop.resources
就可在“解决方案资源管理器”中看到该文件,问题也就解决了。结论:资源文件名应为(default_WebShop.resources)
在程序中调用时应为:
this.rm = new ResourceManager("WebShop.default_WebShop", typeof(WebForm1).Assembly);
因为.resources 文件不象 DLL 那样是影像复制的
建议大家多看看。