How to rebuild .net CF application and deploy in windows mobile emulator using command-line
-
27-09-2019 - |
Question
Is there a ways to rebuild a c# .net CF application and deploy it in windows mobile emulator from the command-line?
This is required to create a bat file for automation.
I have taken a look at http://msdn.microsoft.com/en-us/library/aa188169(VS.90).aspx which mentions how to use the emulator from command line, but doesn't mention how to deploy an application in it.
Thanks,
Vicky
Solution
I just tried calling devenv with the /deploy switch to tell it to deploy to the target and it worked just fine:
devenv /deploy Release "MySolutionName.sln"
OTHER TIPS
There are two steps involved:
- Start the emulator using the Device Emulator Manager (DEM) API
- Execute the target app remotely using RAPI or RAPI2
1. Start the emulator using the Device Emulator Manager API
To programmatically start your emulator you'll need to utilize the Device Emulator Manager (DEM) COM API. To do so from .NET, you'll want to use the Microsoft.DeviceEmulatorManager.Interop.9.0.dll
Primary Interop Assembly, which should be found here (assuming your OS is 64 bit): C:\Program Files (x86)\Microsoft Device Emulator\1.0
While you can use the provided PIA directly, it's much easier to access the DEM API from a custom façade; fortunately, a nice wrapper has already been written and is available from MSDN, along with some great info regarding the API:
How To: Programmatically Control the Windows Mobile Device Emulators from .NET - MSDN
Note: You must "dock" the emulated device before you can use the Remote API - don't forget this step!
DEM documentation:
2. Execute the target app remotely using RAPI or RAPI2
Once you've guaranteed that your emulator is both running and "docked", you can proceed to interact with it via the Remote API (RAPI), allowing you to upload your compiled executable to the device and execute it remotely. Here are a few examples of RAPI use:
- Communicating with a Device from the Desktop (C#)
- The RAPI Demo Example (C++)
- Simple CE synchronisation utility with Python features (IronPython).
- A demo of the Windows CE Remote API (IronPython)
RAPI Documentation:
Conclusion
This should give you everything you need to piece together a simple CLI app to programmatically launch a given app on a given emulator. Please leave a comment if you have any questions.
For deployment to the emulator from the command line, see http://sevaa.home.sprynet.com/cedeploy/