共用方式為


Remote Debugging with Visual Studio 2008

[The following article is authored by one of the Windows Embedded MVPs (Most Valuable Professionals). Our MVPs have a heavy background in Embedded systems and are a great repository of information on Windows Embedded products. We’re providing this space on our team blog as a service to our readers by allowing MVPs to share some of their knowledge with the rest of the community.]

Debugging applications on an embedded device becomes a challenge the smaller the device image gets. On larger images there is a fair chance that Visual Studio can be installed onto a Windows Embedded Standard 2009 system. However, running Visual Studio on the embedded system should not be the initial step when developing a new application. It is much more efficient to work with XP Pro as the development OS, either on the target device, a development PC or even a VPC (if no special hardware interaction is required). This enables the application developer to work out the problems related to the application itself and not related to image configuration. XP Pro, in this case, can be seen as the standardized reference configuration. If the application works fine on this platform, you can move it to an embedded system.

Moving to the embedded device

If the OS developers have been successful in mapping the project requirements to the correct component configuration the applications developed on XP Pro will just run fine on the embedded target in most cases. But there may be requirements that are different on XP Pro, which can cause negative side effects when the application runs on the embedded configuration. Very often security settings are different on an embedded device, or running a custom shell removes functionality and APIs normally offered in Explorer shell.

VS 2008 Installation

As stated before, if the image is functional and the target device capable enough, it is not a problem to install Visual Studio and debug the application directly on the device. This is very beneficial to, for example, resolve problems that can occur with special hardware devices, such as interface cards for field busses . Unfortunately, there is currently not something like a compatibility macro component for Visual Studio. This means that, if there are any errors during the VS setup, you need to work out the reasons for this on your own. Quite often problems are related to missing components or infrastructure in the image. Hints to resolve missing components can either be derived from the error message itself or entries in the Windows Event Log.

Remote Debugging

It has been a long time coming, but Microsoft has finally packed all required files into one single installation routine for Visual Studio 2008 that can be installed onto a remote device. This really is great news because, previously, setting up a remote debug connection needed something of a medieval alchemist’s recipe to implement, and copying and installing files manually (around midnight with a rabbit’s foot in your hand!) did not always work out great. For example, in Visual Studio 6.0 the instructions to set up remote debugging covered roughly 45 pages.
But, this is the past! Now there is a good article on how to set up remote debugging for VS 2008 in the MSDN library, which is just one page.There is also a highly informative video on MSDN showing how to proceed.

It is also good to know that remote debugging is only supported for the Visual Studio Pro and Team Systems versions of the product. If you try it with Standard or Express this setup will not work! Other common problems are mainly related to firewall settings or missing credentials for the user account that is used to access the remote device. Another important aspect is that the runtime environment for your application, be it managed or native, needs to be present in the image. Installing the remote debugger alone is naturally not enough. Therefore, be sure to have the correct .NET Framework or native runtime included.

image

In the component catalog, native runtime components are located in the Application Support node below Software\System Services, while the managed frameworks are to be found in the Other folder. No kidding!

Happy debugging!

- Alexander

Alexander Wechsler

Wechsler Consulting

www.wechsler-consulting.de

Technorati Tags: XPe,Standard 2009

Comments