posts - 20 , comments - 57 , trackbacks - 0

Building Windows CE 6 or 7 Smart Device Application with Visual Studio 2012 (Part 2)

In Part 1 of this blog post we learned how to create a Visual Studio 2012 compatible Windows CE 6 or 7 SDK. Now I show you how you can create Visual Studio 2012 C++ projects (vcxproj) for it. Or if you want, how to upgrade your Visual Studio 2008 projects (vcproj) for Windows CE 6/7 to Visual Studio 2012 projects (vcxproj) for Windows CE 6/7.

If you followed the steps in Part 1 carefully, you should have now the following situation (the same applies to Windows CE 7):

  • A Windows CE 6 SDK folder compatible for Visual Studio 2012 in C:\Program Files\Windows CE Tools\SDKs\MyDevice6
  • The required Property Sheets for a Windows CE 6 SDK in Visual Studio 2012 in C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\MyDevice6
  • A registry key that tells Visual Studio 2012 the root folder of your Windows CE 6 SDK (for Visual Studio 2012) HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows CE Tools\SDKs\MyDevice6

When you start Visual Studio 2012, create a new project, you won’t see a possibility to create straight away a Windows CE 6 “MyDevice6” SDK. The reason is that we haven’t yet created the right Wizard projects for that. I’ll save that – maybe - for a later post.

No worries, we can still continue. Let us for example create a Windows CE 6 Console Application for “MyDevice6” SDK. We start by first creating a Windows CE 8 Console Application for “MyDevice8” SDK (you might just as well start from a Console Application for “WIN32” SDK).

Once the project is created, open the project’s properties. And immediately click in the right upper corner “Configuration Manager”.

Create a new Active solution platform named “MyDevice6” based on a copy of “MyDevice8” (or “WIN32”).

Now a “MyDevice6” configuration is available in your project/solution.

Start with changing the Platform Toolset to “wce600”.

Double check if the Linker | System option is set to “WindowsCE”

Try to compile. It will fail with the message “…\consoleapplication1\targetver.h(8): fatal error C1083: Cannot open include file: 'SDKDDKVer.h': No such file or directory

#include <SDKDDKVer.h>

This construction doesn’t exist in Windows CE 6. I changed it to

#if defined(UNDER_CE) && (_WIN32_WCE < 0x0800)

#else

#include <SDKDDKVer.h>

#endif

You need these kinds of constructions regularly if you compile for different configurations. 

And that is it. The Console Application code is now built with the Windows CE 6 compiler/linker toolset against the Windows CE 6 “MyDevice6” SDK (the correct header files and libraries should be used). If you wish to verify this, right-click on the

#include <stdio.h>

statement and select “Open Document <stdio.h>”. The document should be opened in folder (hoover over the tab <stdio.h>) C:\Program Files\Windows CE Tools\SDKs\MyDevice6\sdk\wce600\include\x86\stdio.h

And that is the file we copied in Part 1 from the original Visual Studio 2008 SDK folder C:\Program Files\Windows CE Tools\wce600\MyDevice6 (x86)


Once again the clever geek might ask “And how do we deploy and run this Console Application on our Windows CE 6 OS?”.

Well unfortunately, the Visual Studio debugger for CE 6 located in C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\Debugger cannot be run in Visual Studio 2012. Also the Visual Studio 2012 debugger for CE 8 located in C:\Program Files\Microsoft Visual Studio 11.0\WindowsEmbeddedCompact doesn’t work with Conmanclient2.exe running on your CE 6 OS. It can only work with Conmanclient3.exe that only runs on a CE 8 OS. If Microsoft would consider (they probably won’t) delivering a ConmanClient3.exe version that runs on a CE 6 (or CE 7) OS, than you could use the Visual Studio 2012 debugger for CE 8 also for CE 6 (or CE 7). Is anyone listening in Redmond?

But you can still use Visual Studio 2008 for debugging. Consider this first. I always compile all my Windows CE 6/7/8 projects also for desktop "WIN32". In fact my C++ vcxproj files contains now all these configuration targets. By doing so, I debug >95% of my time in the desktop "WIN32" configuration, only for these rare cases that I really need to go to the real hardware for debugging, I need Visual Studio 2008. Probably not everyone is in this situation, so they have to decide for themselves what they prefer.

So what are your debug options?

  • Compile and Link all configurations in Visual Studio 2012 and debug with “WIN32” configuration in Visual Studio 2012
  • Compile and Link all configurations in Visual Studio 2012 and debug with “CE 6” or “CE 7” configuration in Visual Studio 2008. Simply create an empty Smart Device Visual Studio 2008 project and set deploy and debug parameters as desired. The Linker | General | Output File should point to the correct executable that you built with Visual Studio 2012. When you run and are asked to rebuild the project, say “No”. Visual Studio 2008 will start your debug session, using the binary executable built with Visual Studio 2012 for Windows CE 6 or 7.
  • Compile and Link all configurations in Visual Studio 2012 and debug with Visual Studio 2008 by attaching to a remote running instance of your application. The disadvantage with this approach is that you cannot hit breakpoints in the early startup phase of the application. It depends on how fast you can attach to the running application; for me this is typically >1 min. The previous approach might be more suitable.

Last but not least I need to tell you that all this is on your own risk. It is not officially supported by Microsoft (nor me). If you feel uncomfortable, don't trash yet your Visual Studio 2008 vcproj files J

I did not investigate (yet) how to convert .NETCF projects, but I am quite convinced it can be done in a similar way.

Good luck!

Print | posted on Friday, September 13, 2013 10:19 PM | Filed Under [ Windows CE Windows Embedded Compact Microsoft Visual Studio 2012 Smart Device application ]

Feedback

Gravatar

# re: Building Windows CE 6 or 7 Smart Device Application with Visual Studio 2012 (Part 2)

windows application please download
11/23/2013 3:36 PM | nitishkumar
Gravatar

# re: Building Windows CE 6 or 7 Smart Device Application with Visual Studio 2012 (Part 2)

Followed all the steps in part 1 and 2 and verified couple of times for building windows CE 6 with visual studio 2012. All seems to go well except the build ends immediately with error TRK0005: failed to locate 'cl.exe'. The system cannot find the specified file. Verified Step 4: Binary folders. The change to Executible path is in place "$(SdkRootPath)bin\x86_cex86". Also noted, that "cl.exe" does not exist in the x86_cex86 directory. Is this the root of the problem? Does it need to be there? This directory was copies directly from Visual Studio 8.

Please help!
7/21/2014 5:53 PM | sam
Gravatar

# re: Building Windows CE 6 or 7 Smart Device Application with Visual Studio 2012 (Part 2)

Can we run windows smart device application on Windows CE .
8/14/2014 9:34 AM | Rozy
Gravatar

# re: Building Windows CE 6 or 7 Smart Device Application with Visual Studio 2012 (Part 2)

Yes, you can.
"Windows CE Smart Device Application project" is the Windows CE 6 terminology for a Windows CE application (exe, dll, lib) that you develop in Visual Studio 2008.
In Visual Studio 2013 you create a project that you target against a Windows CE 8 BSP (similar as in CE 6), as such I retained the naming "Smart Device project".
In fact the way you develop for Windows CE hasn't changed much over the years, only the terminology has changed slightly which might confuse people.
8/14/2014 7:57 PM | Werner
Gravatar

# re: Building Windows CE 6 or 7 Smart Device Application with Visual Studio 2012 (Part 2)

These two articles look like a lot of steps. If anything goes wrong (download isn't there or different version of Windows has moved something), I might not complete the process.

So, to sum up my concerns: Is it worth it? (all these fixes just to use the VS2012 IDE instead of VS2008 Pro)
11/10/2015 3:57 PM | jp2code
Post A Comment
Title:
Name:
Email:
Comment:
Verification:
 

Powered by: