etalon11
etalon11

Reputation: 984

Debugging Windows CE Device from Windows 10 with Visual Studio 2008

I upgraded from Windows 7 to Windows 10 this week. I develop compact framework software for mobile devices (Windows CE7, Windows Mobile e.g.). I use Visual Studio 2008.

Now I get the error: "error connecting to device" (Device Connectivity Component).

Windows Mobile Device Center is running and the device shows up in my explorer. Any hints?

Upvotes: 1

Views: 3088

Answers (4)

AlainD
AlainD

Reputation: 6587

My specific error was "ActiveSync bootstrap initialization failed. Please connect/cradle a real device or download the User-level Windows Mobile Device Center Application..."

This solution is based on the answer from @BrettTaylor. These full instructions were tested on Windows 10 22H2 x64 using Visual Studio 2008 SP1 and a C# application using .NET CF 3.5 targeting Windows CE 6.0:

  • Windows Mobile Device Center 6.1 (WMDC) is deprecated. The link provided in Brett's answer is no longer valid. It may be available, but I was not able to find this product on Microsoft's website.
  • This Microsoft support thread from 2016 points to a manufacturer called Juniper Systems (JS) which hosts a copy of the WMDC.
  • The JS website has an instructional video which is worth watching. The main steps are summarised here with some additional notes.
  • Download and install drvupdate-amd64.exe. This installs driver updates for Windows Mobile development as well as the WMDC application itself. As an aside, the installation proceeds without user interaction.
  • Download and install WMDC-fixes-for-Win10.msi. This installs patch(es) for mobile development. This may be similar to the answer from @Pierre, but JS do not say what the details are except they are required to get "mobile development working on Windows 10". Again, no user interaction was required for the installation.
  • The above installations added three new services: Windows Mobile-2003-based device connectivity (WcesComm), Windows Mobile-based device connectivity (RapiMgr) and Windows Phone IP over USB Transport (IpOverUsbSvc). All were set to "Automatic (Delayed Start)". There may be no harm in leaving these, but I set all to "Manual". After a reboot deployment still works.
  • The above installations added a registry entry to start the WMDC application: HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Windows Mobile Device Center. Again, there may be no harm in leaving this, but I deleted the registry entry, killed the WMDC application in Task Manager, rebooted, and deployment still works i.e. the JS video implies you need the WMDC to be running for deployment, but this is not correct in my experience. It is probably the driver updates or Windows 10 patches that is doing the magic.
  • For actual deployment from VS2008, you need to copy the ARM connectivity tools compatible with VS2008 to the target device (e.g. using a pen drive or the Remote Tools built into Visual Studio). By default these tools are installed at: "C:\Program Files (x86)\Common Files\Microsoft Shared\CoreCon\1.0\Target\wce400\armv4i". I just copied the whole folder to the device.
  • Each time you deploy, you must run ConmanClient2.exe and CMAccept.exe on the device itself. You have ~120s to complete deployment or you need to run them again. Once deployed, until VS2008 or the device is rebooted, you won't need to run these again.

Hope that helps someone else.

Upvotes: 0

Pierre
Pierre

Reputation: 9052

I can't remember where I got this WMDC_Service_Fix.bat file but it fixed the connectivity to the device for me in Windows 10.

Here are the contents of the batch file, just recreate it and run it:

@echo off
::WcesComm is the name of the "Windows Mobile-2003-based device connectivity" service.
::RapiMgr is the name of the "Windows Mobile-based device connectivity" service.
::Both being necessary for proper WMDC functionality.

::The following registry entires set the RapiMgr and WcesComm services to run as seperate processes
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\RapiMgr /v SvcHostSplitDisable /t REG_DWORD /d 1 /f > nul 2>&1
REG ADD HKLM\SYSTEM\CurrentControlSet\Services\WcesComm /v SvcHostSplitDisable /t REG_DWORD /d 1 /f > nul 2>&1
if %errorLevel% == 0 (
    echo Service Registry entries added successfully
    ) else (
        echo Failure: Please run this file as admin.
    goto end_Pause
    )
::Set the compatability of wmdc.exe to Windows Vista (which works more consistently)
REG ADD "HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\Windows\WindowsMobile\wmdc.exe" /d "~ VISTARTM" /f > nul 2>&1
if %errorLevel% == 0 (
    echo Compatability Mode for WMDC successfully set
    ) else (
        echo Failure: Please manually set the compatibility mode for
    echo C:\Windows\WindowsMobile\wmdc.exe
    echo to "Vista" for all users.
    )
echo.

::Stop both the services associated with WMDC
net stop WcesComm
net stop RapiMgr

::Set both the services to run as LocalSystem
sc config WcesComm obj= LocalSystem password= "" > nul 2>&1
sc config RapiMgr obj= LocalSystem password= "" > nul 2>&1
if %errorLevel% == 0 (
    echo Services configured to Log in As LocalSystem
    ) else (
        echo Failure: Services could not be updated
    )

echo.

::Restart the services. Starting WCesComm also starts RapiMgr
net start WcesComm

:end_Pause
pause

I use the Windows CE Device option when debugging on the device (Zebra MC2100 with Windows CE 6.0):

enter image description here

I also use a handy little tool called Remote Display Control for Windows CE or CERDisp. Get it here https://forums.ivanti.com/s/article/CERDisp-Display-and-control-your-Windows-CE-device-from-your-desktop

Upvotes: 2

Brett Taylor
Brett Taylor

Reputation: 31

In case it helps somebody else, I was using Visual Studio 2008 on Windows 10 and trying to connect to a Windows CE 5.0 device and was having the same problem.

The device was being detected by Win 10 and I could browse its file system from my PC etc, but VS2008 was failing to connect with a message:

ActiveSync bootstrap initialization failed. Please connect/cradle a real device or download the User-level Windows Mobile Device Center Application from...

In the end I got it working by manually installing Windows Mobile Device Center 6.1 (there's also a 32 bit version)

Upvotes: 2

etalon11
etalon11

Reputation: 984

I figured out my problem:

In Visual Studio 2008 you can choose between "Windows Mobile 5.0 Pocket PC Device" and "Windows Mobile 5.0 Pocket PC Device R2"

I had to choose "R2" and then it worked for me.

Upvotes: -1

Related Questions