.NET Compact Framework FAQ - .NET Compact Framework 2.0

 

 

 

 

Stuart Celarier, Fern Creek
.NET/XML Consultant, course author, trainer

Please email comments and corrections to faq@ferncrk.com.

Updated January 24, 2005, 6:24 PM Pacific Standard Time

.NET Compact Framework FAQ Pages

.NET Compact Framework (General) | .NET Compact Framework 1.0 | .NET Compact Framework 2.0

Contents of this Page

 

 

 

  • .NET Compact Framework 2.0 Releases

  • Spotlight: In the News

  • .NET Compact Framework 2.0 Development (General)

  • Windows Forms

 

 

 

  • Controls

  • Data

  • COM Interoperability

  • Emulators

 

 

 

  • Debugging

  • Deployment

  • Visual Studio 2005 and Other Tools

 

 

 

Key to Finding Answers in the .NET Compact Framework FAQ

Topics in this FAQ are organized into a series of pages. This key is your guide to the organization of topics into pages and the relations between them.

.NET Compact Framework (General)

.NET Compact Framework (General)covers general topics in developing managed applications for mobile devices, including how to get started, information about devices and native operating systems, as well as debugging and deploying software.

Related sections. See .NET Compact Framework 1.0 for developing with the .NET Compact Framework (CF) 1.0 and Visual Studio .NET.

See .NET Compact Framework 2.0 for developing with pre-release versions of the .NET Compact Framework 2.0 and Visual Studio 2005 (formerly codenamed "Whidbey").

.NET Compact Framework 1.0

.NET Compact Framework 1.0 covers development topics on the .NET Compact Framework (CF) 1.0, as well as Visual Studio .NET 2002/2003 and other tools. There is also information about releases and service packs for CF 1.0.

Related sections. See .NET Compact Framework (General) for general information about developing for mobile devices that is not specific to a version of the .NET Compact Framework.

.NET Compact Framework 2.0

.NET Compact Framework 2.0 covers development topics on the pre-release versions of .NET Compact Framework (CF) 2.0, and using Visual Studio 2005 (formerly codenamed "Whidbey") and other tool. There is also information about different pre-release versions, as well as which features are available in current versions.

Related sections. See .NET Compact Framework 1.0 for information that may be identical in .NET Compact Framework 2.0.

See .NET Compact Framework (General) for general information about developing for mobile devices that not specific to a version of the .NET Compact Framework.

 

.NET Compact Framework 2.0 Releases

  • Where can I get a Beta or Community Technology Preview (CTP) of the .NET Compact Framework 2.0?

    Betas and CTP releases are available to MSDN subscribers in the Subscriber Downloads.

    Daniel Moth, 8 December 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • What devices currently include the .NET Compact Framework 2.0?

    None at this point: since the .NET Framework 2.0 (include .NET Compact Framework 2.0) is in Beta testing, it cannot possibly be included into any shipping device ROM.

    Alex Feinman, 12 December 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Can existing devices download the .NET Compact Framework 2.0?

    Yes, those based on Windows Mobile 2003 and newer.

    Alex Feinman, 12 December 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • What versions of Visual Studio support developing for the .NET Compact Framework 2.0?

    Only Visual Studio 2005 supports .NET Compact Framework 2.0 development.

    Alex Feinman, 12 December 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • What is the expected release date for .NET Compact Framework 2.0?

    The .NET CF 2.0 will likely RTM with Visual Studio 2005 in the first half of 2005. However, the .NET CF 1.0 had a "go live" license that enabled developers to redistribute a prerelease build prior to RTM. It's possible this may happen again.

    It's also possible that .NET CF 2.0 will ship in ROMs on Windows Mobile 2003 devices after it becomes available. It all depends on whether Microsoft provides an adaptation kit for the OEMs and whether the OEMs will opt to use it.

    Also you might anticipate a free SDK for .NET CF 2.0. I don't think anything has been announced, but I know that Microsoft has taken the feedback about not having one for .NET CF 1.0 very seriously.

    Ed Kaim, 13 December 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • How do I get support for the .NET Compact Framework 2.0 and Visual Studio 2005?

    Search or post a question in the the .NET Compact Framework Forum.

    Stuart Celarier, Fern Creek, 1 January 2005#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Spotlight: In the News

  • Deploying CF applications is broken in Visual Studio 2005 November CTP. Is there a fix?

    Symptoms. Using the Visual Studio 2005 November Community Technology Preview (CTP), if you try to deploy your .NET Compact Framework application using F5 or Ctrl+F5 it will fail to deploy.

    Solution:A patch has been made available, on an as-is basis, that fixes this problem. You are strongly encouraged to read the instructions on the Visual Studio for Devices blog before downloading and installing the patch.

    This issue has not been fixed in the December CTP, as reported here. In fact the Device bits in the December CTP are older than those in the November CTP, as explained here.

    Stuart Celarier, Fern Creek, 8 January 2005#

    This FAQ item is current to the Visual Studio 2005 November CTP release. Please report status updates here.

  • Is ClickOnce in .NET Compact Framework 2.0?

    Unfortunately, Visual Studio 2005 will not support ClickOnce for Smart Device projects.

    Ori Amiga, Visual Studio for Devices, Microsoft, 6 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • When will generics be available in the .NET Compact Framework 2.0?

    We are actively working on support for generics in the .NET Compact Framework. We currently anticipate generics to be part of Visual Studio 2005 Beta 2 which I would expect to release in Q1 CY05.

    Ori Amiga, Visual Studio for Devices, Microsoft, 6 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • What new controls are in .NET Compact Framework 2.0?

    .NET Compact Framework (CF) 2.0 has both DateTimePicker and MonthCalendar controls. UserControl is supported in CF 2.0 which should make building controls with designer functionality easier. I'm not sure how much is implemented in the current build.

    Peter Foot, MVP, Windows Embedded, 16 July 2004

    Additional new controls include DocumentList, Notification, and DataConnector. UserControl and CustomControl are both supported current CF 2.0 release, you can create a UserControl as you do in desktop projects, having a UserControl designer and allow you to add controls to it. You can either add a UserControl to the project or adding a Windows Control Library project to your solution.

    Keep in mind that Smartphone platform does not support UserControl so you would need to use CustomControl instead on that plaform.

    David So, 16 July 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • What is the new Smart Device CAB Project in Visual Studio 2005?

    There's a new project type for creating richer CAB files for device projects: it can be found under Other Project Types | Setup and Deployment | Smart Device CAB Project. It now allows you to visually create CABs by dragging-and-dropping registry and file entries, etc.

    Ori Amiga, Visual Studio for Devices, Microsoft, 6 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • What kinds of mobile applications are supported by Visual Studio 2005?

    Visual Studio 2005 (Whidbey) Beta 1 includes Smart Device development. However the Visual Basic and C# Express packages do not.

    Only PocketPC 2003, Smartphone 2003, CE 5 and above, and future Windows Mobile and Smartphone versions will be supported by Visual Studio 2005. If you need to develop for any earlier version of PocketPC, then you need Visual Studio .NET 2003 Pro or above.

    Peter Foot, MVP, Windows Embedded; and Ginny Caughey, MVP, 30 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Can I deploy a .NET Compact Framework 2.0 application to a Pocket PC 2002?

    No, .NET Compact Framework (CF) 2.0 supports Pocket PC 2003 and upwards only. For previous versions you should continue to develop with CF 1.0 and Visual Studio 2003.

    For understanding which tools support which platforms and configurations, the Windows Mobile Development Tool Support Matrix on the Windows Mobile Team Blog should make things a little clearer.

    Peter Foot, MVP, Windows Embedded, 30 September 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

.NET Compact Framework 2.0 Development (General)

  • When should I use GC.Collect?

    Scott Holden of the .NET .NET Compact Framework Team has an extensive post on his blog titled The perils of GC.Collect (or when to use GC.Collect), including links to some other team members' articles, and notes on improvements to garbage collection in .NET Compact Framework 2.0.

    Stuart Celarier, Fern Creek, 8 January 2005#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Can I use MSMQ on a Pocket PC and in the emulator as well?

    I have a MSMQ sample application that was originally developed on Windows 2000/2003 and then ported to Pocket PC 2003. I was able so successfully build it and load it into the Pocket PC 2003 Emulator. But as soon as it tries to enumerate the queues I get an exception.

    How can I set up MSMQ on the Pocket PC Emulator? Or how can I make the Pocket PC Emulator see my local machine and the MSMQ on my local machine?

    Klaus Salchner, 29 August 2004

    To use System.Messaging on emulator or real device, native MSMQ needs to be installed and configured first. Native MSMQ is not included in Visual Studio and needs to be installed separately. It comes with PPC 2003 SDK and located in \Support\msmq folder.

    You have to copy MSMQ files to \windows folder on emulator or device, and configure MSMQ as described in Application Installation of MSMQ (Platform Builder for Microsoft Windows CE 5.0) in the MSDN Library. At that point you can use System.Messaging.

    Ilya Tumanov, Microsoft, 30 August 2004

    MSMQ does work on the .NET Compact Framework 2.0. I have a series of blog posts that will help you, System.Messaging (MSMQ) in CF 2.0, Parts 1, 2, 3 and 4. I got this tested and working on a pre-Beta 1 build using the emulator.

    Also note that to get more detail exception messages you will need to install the resource assembly. Please see What is the "Could not find resource assembly" error message? for more info on this.

    Mark Ihimoyan, Microsoft, 7 September 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Does the .NET Compact Framework 2.0 support asynchronous delegates?

    I'm puzzled by the Beta 1 documentation statement that the .NET Compact Framework (CF) doesn't support asynchronous delegates. This can't still be true with CF 2.0, can it?

    Peter Bernhardt, SharpSense Software LLC, 11 August 2004

    At this time we do not plan on supporting general purpose asynchronous delegates in .NET CF 2.0. I believe only Windows Forms callbacks, BeginUpdate and EndUpdate, will be supported in this release.

    Ori Amiga, Visual Studio for Devices, Microsoft, 11 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Is there cryptography support in .NET Compact Framework 2.0? Where can I find some examples?

    Yes cryptography is supported in .NET Compact Framework (CF) 2.0. The object model follows that of the full .NET Framework, so you should find plenty of examples.

    Also Casey Chesnut has been working with cryptography on .NET CF for a long time and produced his own library for .NET CF 1.0 which has an object model that matches the System.Security.Cryptography namespace. Checkout Casey's articles for examples you can put to use with NET CF v2.0, see .NET Compact Framework and Rijndael / AES by Casey at DevBuzz.com.

    Peter Foot, Windows Embedded MVP, 7 October 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Is there BinaryFormatter support in .NET Compact Framework 2.0?

    The documentation for the BinaryFormatter class in the Visual Studio 2005 Beta Library lists the .NET Compact Framework as a Supported Platform. Is that correct?

    The prerelease documentation you're referring to is incorrect, there's no BinaryFormatter class in the .NET Compact Framework.

    Ilya Tumanov, Microsoft, 29 October 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Windows Forms

  • Change in Form Finalize?

    There seems to be different behavior in identical running code dependent on whether it is targeting the .NET Compact Framework (CF) 1.0 SP3 or current .NET CF 2.0 Beta bits. Simply create a new Form and override the Finalize method.

    Insert two lines of code before calling the base finalizer

    1. Debug.Writeline //works on CE devices

    2. MessageBox.Show

    Under CF 1.0 you will see both the console output and the Message Box just after closing the form. Under CF 2.0 there is no output. Does the finalizer not run anymore or am I missing something?

    Daniel Moth, 31 July 2004

    The reason why the Finalize method was called for forms in the .NET Compact Framework v1.0 is that the Form.Dispose method was never called when a form was being destroyed. That was a bug in v1.0 that could potentially result in memory leaks.

    This bug has been fixed in the .NET Compact Framework v2.0. Now, whenever a form is being destroyed, the Dispose method of that form is called. The Dispose method, in its turn, calls the GC.SuppressFinalize method, which prevents automatic finalization (as a result, the Finalize is not called by the system). The .NET Framework on desktop has the same behavior.

    Sergiy Kuryata, Microsoft, 6 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Is DataNavigator in the .NET Compact Framework?

    No, despite what the documentation states, DataNavigator (which is going to be renamed) support is not planned for .NET Compact Framework. The final documentation will reflect that.

    Ilya Tumanov, Microsoft, 1 September 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Controls

  • How do I create a WebBrowser that can be used with just a keyboard?

    I'm writing an application where we'd like to interface a menu via HTML. I'm using the WebBrowser control. We do not have a mouse hooked up the device, so we need to be able to interface with it using the keyboard. Is there a way to have the WebBrowser control select different items within the HTML page when the keys are hit. Currently if I hit tab nothing happens.

    Luke Jason, 15 July 2004

    You need to make sure you set the TabStop to false for all other controls when WebBrowser control is in focus or else the Tab key will be handled by the Form and used to focus on other controls.

    David So, Microsoft, 19 July 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Can I get the WebBrowser.TextDocument property?

    IntelliSense say that I can get and set the DocumentText property on a WebBrowser control. But when I try to do a get it will not compile.

    Casey Chestnut, 30 July 2004

    This is a bug in the IntelliSense documents. The Get accessor is not supported for the DocumentText property due to the behavior of the native WebBrowser control.

    It may be possible to workaround this in native code. You might be able to do a Select All and send a WM_COPY message to the control and then read the clipboard. Pocket IE supports copying text to the clipboard so that should be supported.

    Sergiy Kuryata, Microsoft; and Peter Foot, MVP, Windows Embedded, 9 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Data

  • How do I export a SQL Server database to a SQL Mobile database?

    I'm working with SQL Server 2005 Beta 2 and VS 2005 Beta 1. How do I export an existing SQL Server 2000 database or SQL Server 2005 database to a SQL Mobile database on my desktop? And how would I do that same thing programmatically?

    Helen Warn, 22 December 2004

    This functionality is not available in Visual Studio 2005 Beta 1, sorry. You'll have to wait for Beta 2.

    Ilya Tumanov, Microsoft, 4 January 2005#

    No product version has been specified for this FAQ item. Please report status updates here.

 

COM Interoperability

  • Is COM interop supported yet?

    I remember reading that the .NET Compact Framework (CF) 2.0 is going to support COM interoperability. Does anyone know how to take advantage of this using CF 2.0?

    Luke Jason, 12 July 2004

    Visual Studio 2005 Beta 1 does have a known issue where you cannot create the interop assembley (IA) directly from the IDE. That is, you can't quite drag-and-drop a component in the Solution Explorer and have the IA automatically created for you. Apart from that, COM interop should be working.

    The workaround is to simply run TLBIMP manually at the command line, and then in your project use Add Reference in Visual Studio 2005 to add a reference to the resulting assembly.

    One caveat, in Beta 1 you will not be able to do this for COM components which have a dependency on other DLLs.

    Ori Amiga, Visual Studio for Devices, Microsoft, 15 July 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Emulators

  • Can I use the emulator in a Virtual PC (VPC)?

    We expect the emulator to work inside VPC. However there are a few rough edges that were left in Beta 1.

    In order for the emulator to establish communication with Visual Studio, it needs to obtain an IP address. It does so by sending a DHCP discover packet to the DHCP server and expecting DHCP offer packet back. If it doesn't receive an offer within certain amount of time, it repeats the DHCP discover packet. If all its discover packets go unanswered, the guest OS selects the DHCP not found address which is 169.x.x.x. If the host OS (in your case this is the OS running inside the VPC) also fails to contact DHCP server and ends up with 169.x.x.x address then communication with the emulator works.

    Due to a security feature in the component used to multiplex the network adapter, an emulator running inside VPC never receives any packets sent to it from outside VPC. This means that if the host OS has a statically assigned IP or has obtained IP from the DHCP server, then the communication with the emulator will fail.

    There is a pretty easy workaround, which involves installing a Loopback adapter inside the host OS. Here are the steps:

    1. For each emulator image you'd like to use - Choose ConnectTo Option from the Tools menu and let it boot. (This step is a workaround for another limitation of the network adapter multiplexer a.k.a. Virtual Switch. It fails to provide the guest OS with a MAC address if it multiplexes a loopback or a bridge. However we cache the guest MAC address for reuse to prevent an overload of the DHCP server, so connecting over another network adapter initializes the cache.)

    2. Install the Loopback adapter as described in How To Install Microsoft Loopback Adapter in Windows 2000.

    3. Go to Tools | Options | Device Tools | Devices | Pocket PC 2003 SE Emulator | Properties | Emulator Options | Network and select Microsoft Loopback adapter in the drop down box for NE2000 Network Card.

    All emulator scenarios should now work, however the emulator can not access the network resources (Virtual Switch Limitation).

    Vladimir, Microsoft, 13 July 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Debugging

  • What does the "Could not find resource assembly" error message mean?

    There has been some confusion about the error message "Could not find resource assembly". Basically, this means that there is some exception that has happened in the program. The error did not happen because it could not find the resource assembly.

    The resource assembly that it is searching for contains exception messages (strings) that would be helpful in debugging what went wrong with the program.

    Since the user is never expected to see this error message if the program works as expected and all exceptions are handled appropriately, it was decided (due to size constraints) that the resource assembly that has these error strings are never put on a user's device. Thus the main target audience of these error strings are developers who would like to debug issues. Hence, when you do an F5 deploy onto the device, the System.SR.dll assembly which have these error strings are copied to the device and the developer can see the error messages. But in case .NET Compact Framework is installed from a redistributable or you are using .NET Compact Framework that come with the device (as a user of the device would be doing), the System.SR.dll is not present on the device. Hence, if the application did come upon an exceptional condition that wasn't handled by the application, this "Could not find resource assembly" message would be shown to the user.

    If you are not using Visual Studio F5 deploy to the device and would still like to see the exception messages, you can achieve this by taking the System_SR_[Language].CAB where [Language] corresponds to the language in which you want to see the error message to appear and clicking on the cab file to install it. For more information on how to do this, see Viewing Error Messages During Development (Smart Device Projects) in the MSDN Library.

    Sandeep Prabhakar, .NET Compact Framework Team, Microsoft, 6 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Deployment

  • How do I create a CAB file?

    In Visual Studio, select the File | New | Project menu item. Select the Other Project Types, select Setup and Deployment, then select Smart Device CAB Project.

    You can now use the CAB visual editor to drag and drop files, create folders, shortcuts, registry entries, etc., similar to creating an MSI on the desktop.

    Ori Amiga, Visual Studio for Devices, 23 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

 

Visual Studio 2005 and Other Tools

  • Is the .NET Compact Framework supported in any of the Visual Studio 2005 Express Editions?

    At this time, Smart Device development is not included in any of the Visual Studio Express versions: Visual Basic, C#, or C++.

    Ori Amiga, Visual Studio for Devices, 20 August 2004#

    No product version has been specified for this FAQ item. Please report status updates here.

  • Do SmartPhone projects still require the .NET Compact Framework 1.1?

    I've just installed the latest drop of Whidbey 8.0.40607.16 (beta1.040607-1600) on a plain XP Pro VPC image.

    I'm trying to create a smart phone project but the IDE can not find the necessary compilers and resources, as it keeps looking into ...\Framework\v1.1.4322\... and failing to compile the project. I also seem to have v1.0.3705 and v1.1.4322 directories but I do not have the runtimes in those locations (as expected given I've only installed v2 with the IDE).

    My understanding is that the current editions of SmartPhones only support .NET Compact Framework (CF) 1.0, including the IDE emulator. I know you can compile against the older CF 1.0 assemblies but given that I've just installed the latest drop I thought the current compilers would be configured to compile against the older CF 1.0 assemblies (if they were shipped with the Whidbey IDE). Do I need to install the v1.1.4322 SDK or is there a workaround for Smartphone projects?

    Peter Stanski, 20 July 2004

    Yes, you do need to install the redistributable for v1.1.4322 (.NET Framework 1.1). The reason for this is that Smartphone project current only supports .NET Compact Framework 1.0 SP1 in Whidbey, and you will need to have .NET 1.1 compiler to compile the project. This is addressed in the readme file.

    David So, 21 July 2004#

    No product version has been specified for this FAQ item. Please report status updates here.