9

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

Vicky
  • 1,107
  • 2
  • 13
  • 25
  • +1 - I need to know the second half - how to deploy an executable automatically (building is straightforward). – Charles Dec 07 '10 at 22:55

3 Answers3

1

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"

ctacke
  • 66,480
  • 18
  • 94
  • 155
0

For deployment to the emulator from the command line, see http://sevaa.home.sprynet.com/cedeploy/

Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
0

There are two steps involved:

  1. Start the emulator using the Device Emulator Manager (DEM) API
  2. 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:

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.

Charles
  • 6,199
  • 6
  • 50
  • 66
  • While this is a well-researched answer that contains good information, it doesn't actually answer the original question of "how do I rebuild and deploy from the command line". Just calling devenv is a whole lot less steps and does what the questioner was after. – ctacke Jan 04 '11 at 02:15
  • @ctacke: Yes, it does appear that I've misinterpreted the OP's question; I figured he was looking for what I was after, which was a means of automatically deploying a compiled application without any dependency on the source files or msbuild/devenv/etc. Perhaps I should post a question of my own and move this answer over to it? – Charles Jan 04 '11 at 16:53
  • yes, if you had the question and it's not on here, ask it and answer yourself. – ctacke Jan 04 '11 at 20:41