Saturday, March 17, 2007

What's the Deal: Smart Device Project Ordering in Visual Studio 2005

While creating an application earlier this afternoon for testing a proposed change, I went to create a new Windows Mobile 5.0 Pocket PC application using Visual Studio 2005's New Project dialog. I was curious as to why the entries underneath Visual C#\Smart Device seemed to be in alphabetical order except for Windows Mobile 6 Professional.

The entries were in the following order under Smart Device:


  • Pocket PC 2003

  • Windows Mobile 6 Professional

  • Smartphone 2003

  • Windows CE 5.0

  • Windows Mobile 5.0 Pocket PC

  • Windows Mobile 5.0 Smartphone

  • Windows Mobile 6 Standard



Image 1 - New Project dialog out of order


After a little bit of digging around in the C:\Program Files\Microsoft Visual Studio 8\ directory, I found a folder structure with the hierarchy of "Common 7\IDE\ProjectTemplates\CSharp\SmartDevice". Inside the SmartDevice folder was a file named TemplateIndex.vstdir and 7 folders:


  • PocketPC2003

  • ppc

  • Smartphone2003

  • sp

  • Windows Mobile 6 Professional

  • Windows Mobile 6 Standard

  • Windows CE



Image 2 - SmartDevice folder structure


I soon noticed that each of the 7 folders had their own TemplateIndex.vstdir files. I did a search on that file and discovered an excellent blog entry entitled "New Project Generation: Under the Hood" by the Visual Studio Documentation Team. It confirmed my suspicions that the SortIndex was what controlled the ordering and also brought to my attention that I needed to start visual Studio using the /installvstemplates command line parameter in order for the changes to take effect.


Entry Old Sort Index New Sort Index
Pocket PC 2003 1100 1100
Smartphone 2003 1110 1110
Windows CE 5.0 1120 1120
Windows Mobile 5.0 Pocket PC 1150 1130
Windows Mobile 5.0 Smartphone 1160 1140
Windows Mobile 6 Professional 1100 1150
Windows Mobile 6 Standard 1100 1160





After making the changes to the associated TemplateIndex.vstdir files, I ran Visual Studio with the /installvstemplates command line parameter.

Image 3 - Visual Studio started via command line


When Visual Studio finished processing the template files and opened, going to the New Project dialog had things ordered alphabetically underneath SmartDevice:


  • Pocket PC 2003

  • Smartphone 2003

  • Windows CE 5.0

  • Windows Mobile 5.0 Pocket PC

  • Windows Mobile 5.0 Smartphone

  • Windows Mobile 6 Professional

  • Windows Mobile 6 Standard



Image 4 - New Project dialog in order