jeudi 29 mai 2014

Visual studio 2008 - app Debug .NET Compact Framework sur place (sans émulateur ou un périphérique) - Stack Overflow


I am currently in the preparation phase for a new project that will be developed with .NET Compact Framework (2.0 or 3.5, we'll see) and will run on a custom Windows CE 6 hardware. There is, however, one thing I can't get to work:


Debugging seems to be possible only with a physical device or with the emulator. But when I just start the app from explorer, it runs happily on my desktop (because, of course, the CF is installed on my development machine. So, the actual question is:


How can I debug my .NET CF app on my desktop system with the app running on the desktop CF framework? Or is this not possible? If the latter, how should I do this? Create a non-CF project for debugging? I know I should debug on the device and that is essential for the back-end of the app, but the GUI can be debugged on the desktop. Since it's using OpenGL, it runs much faster than in the emulator (the device has OpenGL acceleration).




Generally I create 2 projects one for desktop and one for CF. The desktop version is a desktop exe that just references CF .dlls (this is fine). Obviously you'll need to push your main app into librarys and make your actual .exe just a very light wrapper (but this is quite nice design anyway)


It's not actually running on the CF but the FF so there are a few compatability issues you may notice in a difference of the implementations.


The other option is to use the debugging option in Visual Studio to "attach to process". That way you can run the app by double clicking and then just attach to that process.




Follow this guide by Daniel Moth to setup a "My Computer" deploy target:


"The Moth: Deploy to My Computer"


Then choose this as the deploy target for your Smart Device Project and press F5. Try to stay clear of any platform specific modules/methods etc.


There are a lot of great blog entries in mr Moth's blog if you are an Compact Framework developer.




I know what you mean regarding slow performance of the emulator when debugging CF apps.


Unfortunately, I don't think this is possible out of the box. If you notice, the debugger in VS always checks what is your connected device in order to decide if your app should be deployed or not, depending on whether you have any changes since the last deploy.


If someone wants to debug in something other than the emulator or the device, they should try and put another "emulator" in that list, that maybe it is not the typical emulator, but the desktop itself. Unfortunately, I don't think this is possible.


Of course I am ready to be corrected by someone more experienced in CF development. I would be really interested if such a technique for debugging CF apps, exists!




To prepare the device for connecting



  1. Using whatever connection with the device you have, copy the following files to the \Windows\ folder on the device. These files are located on the development computer by default at \Program Files\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\. Clientshutdown.exe ConmanClient2.exe CMaccept.exe eDbgTL.dll TcpConnectionA.dll

  2. From the command prompt on the device, run conmanclient2.exe.

  3. Determine the IP address of the device.


To prepare Visual Studio for connecting



  1. On the Visual Studio Tools menu, click Options, then click Device Tools, and then click Devices.

  2. Select Windows CE Device, and then click Properties.

  3. To the right of the Transport box, click Configure.

  4. In the Configure TCP/IP Transport dialog box, select Use specific IP address, and then type the device IP address.


To set security and establish the connection 1. At the command prompt on the device, run cMaccept.exe.



I am currently in the preparation phase for a new project that will be developed with .NET Compact Framework (2.0 or 3.5, we'll see) and will run on a custom Windows CE 6 hardware. There is, however, one thing I can't get to work:


Debugging seems to be possible only with a physical device or with the emulator. But when I just start the app from explorer, it runs happily on my desktop (because, of course, the CF is installed on my development machine. So, the actual question is:


How can I debug my .NET CF app on my desktop system with the app running on the desktop CF framework? Or is this not possible? If the latter, how should I do this? Create a non-CF project for debugging? I know I should debug on the device and that is essential for the back-end of the app, but the GUI can be debugged on the desktop. Since it's using OpenGL, it runs much faster than in the emulator (the device has OpenGL acceleration).



Generally I create 2 projects one for desktop and one for CF. The desktop version is a desktop exe that just references CF .dlls (this is fine). Obviously you'll need to push your main app into librarys and make your actual .exe just a very light wrapper (but this is quite nice design anyway)


It's not actually running on the CF but the FF so there are a few compatability issues you may notice in a difference of the implementations.


The other option is to use the debugging option in Visual Studio to "attach to process". That way you can run the app by double clicking and then just attach to that process.



Follow this guide by Daniel Moth to setup a "My Computer" deploy target:


"The Moth: Deploy to My Computer"


Then choose this as the deploy target for your Smart Device Project and press F5. Try to stay clear of any platform specific modules/methods etc.


There are a lot of great blog entries in mr Moth's blog if you are an Compact Framework developer.



I know what you mean regarding slow performance of the emulator when debugging CF apps.


Unfortunately, I don't think this is possible out of the box. If you notice, the debugger in VS always checks what is your connected device in order to decide if your app should be deployed or not, depending on whether you have any changes since the last deploy.


If someone wants to debug in something other than the emulator or the device, they should try and put another "emulator" in that list, that maybe it is not the typical emulator, but the desktop itself. Unfortunately, I don't think this is possible.


Of course I am ready to be corrected by someone more experienced in CF development. I would be really interested if such a technique for debugging CF apps, exists!



To prepare the device for connecting



  1. Using whatever connection with the device you have, copy the following files to the \Windows\ folder on the device. These files are located on the development computer by default at \Program Files\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\. Clientshutdown.exe ConmanClient2.exe CMaccept.exe eDbgTL.dll TcpConnectionA.dll

  2. From the command prompt on the device, run conmanclient2.exe.

  3. Determine the IP address of the device.


To prepare Visual Studio for connecting



  1. On the Visual Studio Tools menu, click Options, then click Device Tools, and then click Devices.

  2. Select Windows CE Device, and then click Properties.

  3. To the right of the Transport box, click Configure.

  4. In the Configure TCP/IP Transport dialog box, select Use specific IP address, and then type the device IP address.


To set security and establish the connection 1. At the command prompt on the device, run cMaccept.exe.


0 commentaires:

Enregistrer un commentaire