全局资源文件 asp.net

Global Resource File asp.net

好的,下图解释了一切。

我还包含了进一步解释的代码。

Thread.CurrentThread.CurrentCulture = New CultureInfo(Session("Lang").ToString())
Dim rm As ResourceManager = New ResourceManager("TodayTimesheet.App_GlobalResources.Lang", Assembly.GetExecutingAssembly())
Dim ci As CultureInfo = Thread.CurrentThread.CurrentCulture
btnSubmit.Text = rm.GetString("Add", ci)

错误信息:

An exception of type 'System.Resources.MissingManifestResourceException' occurred in mscorlib.dll but was not handled in user code

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

没关系...

我已通过替换以下行自行解决了该问题

 Dim rm As ResourceManager = New ResourceManager("TodayTimesheet.Lang", System.Reflection.Assembly.Load("TodayTimesheet"))