First I will start with what I am trying to accomplish, then I will provide contextual details:
When I select Start Debugging, I want the output directory to change depending on which device is connected over Windows Mobile Device Center. Clarification: Installing from our setup program works fine, but debugging from Visual Studio is what is giving me problems.
I am using Visual Studio 2008. The project is a Smart Device project written in C# for for Compact Framework 3.5 and targets Windows Mobile 5.0 Pocket PC Device R2(according to the project settings). I have found that when I target this device type, it works correctly on all versions of Windows Mobile that we support along with Windows CE 6. Any proposed solution will have to work on both Windows Mobile and Windows CE.
When I go into the project Properties, and go to the Devices tab, it shows Output file folder: and the path for output. If I click on the ... button I can change this to different defaults or even set it to Root Folder and then fully specify the exact path I want as the Subdirectory. On most devices if I just leave it at (Device Default) or select Program Files Folder from the drop down list it works fine. The problem is that when it runs on the Windows CE device that we support it needs to run from a different location.
Possible Solutions:
Multiple project Solution: Have multiple projects for different devices. The problem with this is I don't know how to do that without violating the DRY principal for some of the files that need to be included with the output and I don't want to have to switch back and forth between different Start projects.
Redefine %CSIDL_PROGRAM_FILES%
solution: Change what %CSIDL_PROGRAM_FILES%
means since this can be in the output path specifying where Program Files is. However I don't know if this is possible or where to start with attempting this. I thought maybe this would be defined in the device registry, but I can't find it.
Custom path variable solution: Select Root Folder and then under Subdirectory somehow reference a variable (perhaps by starting and ending with a %
?) in the path that I can change to what I need (perhaps from a post-build or pre-deploy(if there is such a thing) script). I don't know if this is possible or where to start with this.
Any help will be appreciated, thanks!
EDIT:
After doing some digging, my best guess is that %CSIDL_PROGRAM_FILES%
is a Windows CE environment variable. I still don't know if it is possible to create or modify these.
Using different solution/project configurations to use different output path and debug settings:
In VS right click the solution and "Configuration Manager"
Inside the list below "Active solution configuration" click
Now enter a new descriptive name and which settings may be copied for the new config. Please enable "Create new project configurations" and click OK
You now got a new solution and a new project configuration.
Click OK to close the solution config manager.
To change the settings for all or individual project configurations you have to right click the solution and then select Properties
Now you can have different settings for each configuration.
Deployment settings for "Release_Device1" config:
But different deployment settings for "Release" config:
You can also have different Debug settings in your configuration set:
Any thing to add?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With