Alex Feinman wies mich gestern darauf hin, dass es anscheinend beim Erstellen von CAB Dateien mit lokalisierten Ressourcen unter Visual Studio 2008 zu einem Fehler kommt. Dies konnte ich selbst nachstellen.
Eine Variante zur Reproduktion:
1. Erstellen einer Geräteanwendung als C# oder VB.NET project
2. Hinzufügen einer neuen Ressource "Resource.en-US.resx"
3. Hinzufügen einer neuen Ressource "Resource.zh-TW.resx"
4. Hinzufügen einiger Strings zu den Ressource-Dateien
5. Erstellen des Projektes. Beachten Sie dabei, dass die entspr. erstellten Ressource-Dateien in den Unterordnern en-US and zh-TW abgelegt werden-
6. Hinzufügen eines CAB-Projektes für intelligente Geräte zur Projektmappe.
7. Hinzufügen der Projektausgabe/Primäre Ausgabe
8. Hinzufügen der Projektausgabe/Lokalisierte Ressourcen
9. Erstellen der CAB Datei. Installieren auf einem mobilen Gerät, wonach die installierten Resource-DLLs vom Zielverzeichnis des Gerätes auf die Desktop Machine kopiert werden.
10. Analysieren der DLLs mit ILDASM auf die MANIFEST/.locale. Alternativ: Reflector
Ergebnis:
Beide Ressource-DLLs sind identisch. Im konkreten Fall sind beide Dateien die der Sprache zh-TW.
Durch weitere Recherche stellte sich heraus, dass es sich hierbei um einen bereits bekannten Bug im CAB Wizard handelt. Somit geschieht dieser Fehler bei der manuellen Erstellung einer CAB Datei, als auch im Visual Studio.
Ilya Tumanov beschreibt hier hierzu einen Workaround:
...
Here's a workaround:
1. In main project which produces resource files run a post build procedure
which would create copies of these files with unique name.
For example, "fr\CONVENO Sales.resources.dll" would be copied to
fr\fr_CONVENO Sales.resources.dll
2. In your CAB project add files with unique names instead of originals.
3. Select these files one by one, choose "Rename" in context menu and type
original name.
Here's sample INF. Note files are unique now, but original names would be
restored on device.
Also note I've added files to "Application folder" so %InstallDir% macro is
actually used.
This macro can be redirected to storage card upon installation.
[Version]
Signature="$Windows NT$"
Provider="Microsoft"
CESignature="$Windows CE$"
[CEStrings]
AppName="PPC_CAB_1"
InstallDir=%CE1%\%AppName%
[Strings]
Manufacturer="Microsoft"
[CEDevice]
VersionMin=4.0
VersionMax=5.99
BuildMax=0xE0000000
[DefaultInstall]
CEShortcuts=Shortcuts
AddReg=RegKeys
CopyFiles=Files.Common1,Files.Common2,Files.Common3
[SourceDisksNames]
1=,"Common1",,"C:\Projects\LVTest\LVTest\bin\Debug\Fr\"
2=,"Common2",,"C:\Projects\LVTest\LVTest\bin\Debug\"
3=,"Common3",,"C:\Projects\LVTest\LVTest\bin\Debug\Gr\"
[SourceDisksFiles]
"fr_test.txt"=1
"LVTest.exe"=2
"gr_test.txt"=3
[DestinationDirs]
Shortcuts=0,%CE2%\Start Menu
Files.Common1=0,"%InstallDir%\Fr"
Files.Common2=0,"%InstallDir%"
Files.Common3=0,"%InstallDir%\Gr"
[Files.Common1]
"test.txt","fr_test.txt",,0
[Files.Common2]
"LVTest.exe","LVTest.exe",,0
[Files.Common3]
"test.txt","gr_test.txt",,0
[Shortcuts]
[RegKeys]
--
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
...
Andere Alternative: WinCE CAB Manager von ocpSoftware.
Angeblich ist dieser Bug schon länger bekannt, doch ein Fix ist seitens MS nicht in Sicht.
Danke Alex und Ilya, für die Information.
- English Version -
Alex Feinman informend me, that on creating CAB files including localized ressources under Visual Studio 2008 it can come to an error. I've been able to reproduce this behaviour.
One way of Reproduction:
1. Create a Form-based SmartDevice C# or VB.NET project
2. Add a new resource called Resource.en-US.resx
3. Add a new resource called Resource.zh-TW.resx
4. Add some strings to the resource files
5. Build the project. Observe that the resource DLLs are correctly
generated and placed into subdirectories en-US and zh-TW
6. Add a SmartCab deployment project to the solution.
7. Add Project Output/Primary Output
8. Add project Output/Localized Resource Assemblies
9. Build the cab file. Install it on the device and copy the resource
DLLs from the device install directory to the desktop machine.
10. Examine the DLLs with ILDASM tool checking MANIFEST/.locale. Or use Reflector.
Result:
Both resource DLLs are identical. In this case both are from the language zh-TW.
Trough further investigation it turned out, that this is a well known bug within the CAB Wizard. Therefore this bug affect manual building CAB files as well as building them from inside Visual Studio.
Ilya Tumanov describes here a Workaround:
...
Here's a workaround:
1. In main project which produces resource files run a post build procedure
which would create copies of these files with unique name.
For example, "fr\CONVENO Sales.resources.dll" would be copied to
fr\fr_CONVENO Sales.resources.dll
2. In your CAB project add files with unique names instead of originals.
3. Select these files one by one, choose "Rename" in context menu and type
original name.
Here's sample INF. Note files are unique now, but original names would be
restored on device.
Also note I've added files to "Application folder" so %InstallDir% macro is
actually used.
This macro can be redirected to storage card upon installation.
[Version]
Signature="$Windows NT$"
Provider="Microsoft"
CESignature="$Windows CE$"
[CEStrings]
AppName="PPC_CAB_1"
InstallDir=%CE1%\%AppName%
[Strings]
Manufacturer="Microsoft"
[CEDevice]
VersionMin=4.0
VersionMax=5.99
BuildMax=0xE0000000
[DefaultInstall]
CEShortcuts=Shortcuts
AddReg=RegKeys
CopyFiles=Files.Common1,Files.Common2,Files.Common3
[SourceDisksNames]
1=,"Common1",,"C:\Projects\LVTest\LVTest\bin\Debug\Fr\"
2=,"Common2",,"C:\Projects\LVTest\LVTest\bin\Debug\"
3=,"Common3",,"C:\Projects\LVTest\LVTest\bin\Debug\Gr\"
[SourceDisksFiles]
"fr_test.txt"=1
"LVTest.exe"=2
"gr_test.txt"=3
[DestinationDirs]
Shortcuts=0,%CE2%\Start Menu
Files.Common1=0,"%InstallDir%\Fr"
Files.Common2=0,"%InstallDir%"
Files.Common3=0,"%InstallDir%\Gr"
[Files.Common1]
"test.txt","fr_test.txt",,0
[Files.Common2]
"LVTest.exe","LVTest.exe",,0
[Files.Common3]
"test.txt","gr_test.txt",,0
[Shortcuts]
[RegKeys]
--
Best regards,
Ilya
This posting is provided "AS IS" with no warranties, and confers no rights.
...
Alternative: WinCE CAB Manager von ocpSoftware.
This bug is said to be known for a longer period of time but no fix from MS it to be seen on this.
Thanks Alex and Ilya for this information.