Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change output file folder based on device

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.

like image 981
still_dreaming_1 Avatar asked Nov 13 '22 10:11

still_dreaming_1


1 Answers

Using different solution/project configurations to use different output path and debug settings:

In VS right click the solution and "Configuration Manager" enter image description here

Inside the list below "Active solution configuration" click enter image description here

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. enter image description here

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 enter image description here

Now you can have different settings for each configuration.

Deployment settings for "Release_Device1" config: enter image description here

But different deployment settings for "Release" config: enter image description here

You can also have different Debug settings in your configuration set: enter image description here

Any thing to add?

like image 120
josef Avatar answered Nov 15 '22 06:11

josef