What’s wrong with my product name? Why special characters need not apply.

Recently while porting another subset of Chris Craft’s 30 Days of .NET applications to C++ I came across another example where the Visual Studio Smart Device CAB deployment functionality has a small trap that could trip up developers new to the tool, and it all depends upon the name you choose for your product…

Day 10 introduced an application named “What Is My IP?“. While creating the CAB file to deploy this application I followed Chris’s lead and set the Product Name to “What Is My IP?”, as shown in the screenshot below.

Screenshot showing Product Name property for CAB file

Everything compiled without error but when I went to install the CAB file I was greeted with the following error message:

Screenshot showing Windows Mobile device failing to install CAB file

Alternatively in some circumstances I could install the application, but uninstallation would fail without removing a single file or shortcut!

The Problem

In a previous blog post I discussed the internal structure of Windows Mobile CAB files. It turns out the problem is to do with the question mark at the end of the product name.

The Visual Studio Smart Device CAB Deployment project also makes use of the Product Name as the default installation directory. Within the *.INF file produced behind the scenes you will find a section similar to the following.

AppName="What Is My IP?"

When this file is processed to produce a CAB file, the _setup.xml file within the CAB will contain the following XML snippet:

<parm name="InstallDir"
      value="%CE1%\What Is My IP "
      translation="install" />

Since a question mark is not a valid character for a directory name it has been replaced with a trailing space. It seems this additional space is enough to trip up something within wceload.exe, the executable responsible for installing CAB files on Windows CE based devices.

The Solution

The only solution I’ve been able to come up with is to ensure that your product name does not end in a character that is not valid for a directory name. In this example I renamed the Product Name to “What Is My IP”.

Another alternative is to manually create your CAB file by writing your own *.INF file. By doing this you will be able to default the installation to a directory which isn’t mapped 1 to 1 to your Product Name.

One Response to “What’s wrong with my product name? Why special characters need not apply.”

  1. Carl says:

    I noticed something similar when trying to run wceload.exe using rapistart.exe with a cab file name that contains spaces. To get my batch script to work, I had to change the spaces with underscores:

    “C:\Program Files\Windows Mobile Developer Power Toys\CECopy\cecopy.exe” /s “cab\Release\My App.CAB” dev:\My_App.cab

    “C:\Program Files\Windows Mobile Developer Power Toys\RAPI_Start\rapistart.exe” \Windows\wceload.exe /silent /confignotify My_App.CAB

Leave a Reply