Troubleshooting the dreaded "Unable to start program '%CSIDL_PROGRAM_FILES%..." problem

If you have used Visual Studio to write Windows Mobile applications, you might have come across the following error message when you press F5 to start the debugger:

 ---------------------------
Microsoft Visual Studio
---------------------------
Unable to start program '%CSIDL_PROGRAM_FILES%\<target_path>'.  
The system cannot find the file specified. 
---------------------------
OK   
---------------------------

Although the error message seems intuitive, the root cause is far from clear. In order to understand the root cause, it's important to remember that when you press F5 to debug a Windows Mobile application, three things happen:

  1. The project is built
  2. The application is deployed to the device
  3. The application is started on the device

Each of the steps above is a separate stage and can be configured independently. The reason for the error message above is that the step to deploy the application to the device, i.e. step #2 above did not happen. The most common reason for this is that the option to deploy the application to the device is turned off in the Configuration Manager.

To check whether this is the case, open the Configuration Manager (Build -> Configuration Manager...). In the Configuration Manager, verify that the Deploy option for the device project is enabled.

Configuration Manager

Habib Heydarian.