Friday, September 26, 2008

CabWizFixer: Support for files with the same name on Smart Device CAB installers

There is a know bug in cabwiz.exe when your deployment needs several files with the same name in separate folders. This is a typical scenario when you have multiple resource files (i.e. using localization) in a Smart Device Cab Project, but it can also be present when you try to face an app in a generic approach depending on the folders/files structure or just even as a bad coincidence in your app file names. In all cases the cab installer will mess up your deploy copying the same file in all your folders for each group of namesakes.

Let's see an example:

Update: The originally posted 7Wonders sample application has been removed due to copyright issues after asking them about the usage of their material. I replaced that sample with this one:

The Small Catalog Mobile app

This is quite a basic sample, but useful enough, of a good generic approach for a problem. The Problem: We need to implement a Pocket PC app to show a small and simple catalog of a few products. Just a way to show a set of pictures and a quick description of each product. The app should be very simple, and we don't need even to have a database. So, we can just rely on the file directory structure where each subfolder in our app folder will be a new product. The folder name is the product name, and it includes two files named description.txt and picture.jpg for the product description and image correspondingly.

Actually, this approach also makes things easier during the development process. We can build the directory structure in our project as we want it once it's deployed on the device in a sort of WYSIWYG design experience.

 image

You can download the sample solution source code from the following link:

The solution includes two projects: BasicCatalog project itself, and a setup project. If you try to debug or run the solution from VS, it will be deployed and run as expected. But if you try to install the cab generated thru the setup project, the app will show always the same description and picture for all the products. The reason of this behavior is the cabwiz bug described at the beginning of this post. The same picture.jpg and description.txt files have been installed in all the product folders.

CabWizFixer

Here's when CabWizFixer can help us. This is a small tool we made internally based on part of the source code from the Clarius Orientation Aware Control which includes a built-in workaround for the cabwiz issue, a strong requirement for OAC applications as well as it relies on and extends the standard localization infrastructure provided by .NET Compact Framework.

With CabWizFixer, the Basic Catalog installer will work as expected. After install the tool, you just need to rebuild the installer and the new generated cab will install all the right files on the right location.

CabWizFixer is a experimental tool and it's provided "as is" with no warranties whatsoever. If you want to try it, here is the command-line installer:

For uninstall it just launch from a command-line console:

CabWizFixerInstaller.exe /uninstall


I hope this tool makes your life a little bit easier :)

Take care!

4 comments:

ashvin said...

Hi,

I've downloaded the fix and installed it. I am rebuilding the CAB project, and the desired cab is never produced. The log always complaining that some of my DLLs missing at a specific path, while the files are actually present there.

Any idea?

Rgds,
Ashvin

Jose Gallardo said...

Hi ashvin,
Can you please send me an email to jose@mobilepractices.net including the details, particularly the .inf file generated during the CAB project build process?
The log and ideally the project sourcecode would be also great.

Thanks!

ashvin said...

Hi Jose,

thanks for your reply... i've sent you an email with further details... please let me know your thoughts...

Ashvin

Ikon said...

Hi

Thank you for this tool, I was being driven crazy with localization not working as expected.