首页 文章

使用cab文件安装应用程序时,特定于文化的字符串资源dll无法在.net紧凑框架中工作

提问于
浏览
3

我在Windows Mobile 6.1上使用visual studio 2008和.net compact framework 3.5创建了一个本地化的应用程序 . 为了实现本地化,我为此使用了许多资源文件,每个文件对应一个:

StringResources.de-DE.resx

StringResources.es-ES.resx

StringResources.en-GB.resx

StringResources.fr-FR.resx

StringResources.nl-NL.resx

我还有一个StringResources.resx文件,其中包含回退的默认字符串,以防我的应用程序不支持其他文化 .

我还使用"SmartDeviceCabProject"(vdproj类型)在设备上执行此应用程序的安装,从而创建了一个.cab文件 . (using msdn.microsoft.com/en-us/library/aa446504.aspx)

Here is the problem that I am facing: 当我将文化改为nl-NL以外的任何东西时,我总是得到默认字符串 .

Please also note that when I copy paste the "bin" folder of the application into the device, all culture strings are seen. Only when application is installed via the cab file that the problem occurs.

此外,如果我删除StringResources.nl-NL.resx文件,只有

StringResources.de-DE.resx

StringResources.es-ES.resx

StringResources.en-GB.resx

StringResources.fr-FR.resx

作为特定于文化的资源并重新创建cab文件,现在看到当我将文化更改为fr-FR以外的任何文件时,我总是得到默认字符串 . 因此,只有最后一个文化文件始终有效 .

为了确保我通过设备上的cab文件区分了每个文化文件夹中安装的dll:de-DE \ Application.StringResources.dll

ES-ES \ Application.StringResources.dll

EN-GB \ Application.StringResources.dll

FR-FR \ Application.StringResources.dll

NL-NL \ Application.StringResources.dll

Strangely I found all the dlls are exact same. However if I diff the dlls present in the "bin" folder, they are found to be different.

因此,我认为.cab文件构建导致将相同的DLL复制到每个文件夹 .

考虑到上述说明,请帮助我:

** 1 . 如何使cab文件安装适当的DLL到文件夹?

  • 还有其他方法可以放置正确的dll吗?

  • 有没有其他方法可以实现本地化?**

1 回答

  • 6

    此问题已在WizCab.exe中注册为错误:Smart Device CAB Project includes wrong localized resources .

    我发现解决问题的最佳方法是:

    • 使用将资源文件复制到唯一(文件)名称的本地化资源向项目添加后期构建事件:

    复制“$(TargetDir)sv \ $(TargetName).resources.dll”“$(TargetDir)sv \ sv _ $(TargetName).resources.dll”

    对于每种现有语言 .

    • 执行构建并用空文件覆盖这些唯一资源文件 - 否则visual studio GUI将不允许您重命名(步骤4)添加的文件 .

    • 将复制的本地化程序集添加为文件(右键单击.cab-project并选择“应用程序文件夹”下的“查看” - >“文件系统”)到正确的本地化文件夹,而不是使用对项目输出的引用 .

    • 将“文件系统视图”中添加的程序集重命名为原始名称(“YourProject.resources.dll” . )

    不是很好,但它的工作原理 .

相关问题