我是.NET主题的新手。我创建了一些使用语言资源文件的表单。 在绑定期间,会发生以下情况,我不知道语言“de-DE”的设置位置
在默认日志分类中:
*** Assembly Binder Log Entry (8/28/2015 @ 4:40:24 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable C:\Program Files (x86)\Prg\sample.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = MyForms.1.41.resources, Version=0.0.0.0, Culture=de-DE, PublicKeyToken=xxxxxxxxxx
(Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/ Prg/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = sample.exe
Calling assembly : MyForms.1.41, Version=0.0.0.0, Culture=neutral, PublicKeyToken= xxxxxxxxxx.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Prg\sample.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: MyForms.1.41.resources, Version=0.0.0.0, Culture=de-DE, PublicKeyToken= xxxxxxxxxx
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Prg/de-DE/MyForms.1.41.resources.DLL.
LOG: All probing URLs attempted and failed.
现在我所需的文件位于“de”目录下,而不是在URL中搜索的“de-DE”目录下!
我还在MyForms.1.41.resources上调用了带有 / culture:de 标志的Al.exe,但没有任何乐趣。
感谢任何帮助。
我不能使用目录“de-DE”,因此无法覆盖目录名,“de”是必须的。 THX。
答案 0 :(得分:0)
似乎有可能以编程方式设置资源文件的文化:
Thread.CurrentUICulture Property
如MSDN所述。
在我的情况下,默认文化设置为de-DE,并且从reg键读取当前文化。遗憾的是,缺少reg密钥,因此使用了默认密钥。 干杯......