代码之家  ›  专栏  ›  技术社区  ›  B.Robert

.NET资源文件绑定区域性错误

  •  0
  • B.Robert  · 技术社区  · 10 年前

    我是.NET主题的新手。我已经创建了一些使用语言资源文件的表单。 在绑定过程中,发生了以下情况,我不知道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目录下!

    我还调用了带有标志的Al.exe /文化:de 在MyForms.1.41.资源,但没有快乐。

    感谢任何帮助。

    我无法使用目录de de,因此无法覆盖目录名,de是必须的。 谢谢。

    1 回复  |  直到 10 年前
        1
  •  0
  •   B.Robert    10 年前

    似乎有可能以编程方式设置资源文件的区域性:

    Thread.CurrentUICulture Property 
    

    如中所述 MSDN .

    在我的例子中,默认区域性设置为de de,而当前区域性是从注册表项读取的。遗憾的是,缺少注册表项,因此使用了默认注册表项。 干杯

    推荐文章