In the previous post we saw how to sign an assembly (my M2Mqtt library) to include it directly into the Windows Embedded Compact 2013 operating system image and register it into the GAC (Global Assembly Cache). During this post, we will see how it is possible to make a component for the Platform Builder catalog items through which include our library into the image in a very simple way.

How to create a component ? The available solutions

When we build an Windows Embedded Compact 2013 operating system image for a target device, there is often the need to add our custom component (an application, a library or any other type of file) to the image itself, without using the Platform Builder catalog items because this component is proprietary and it isn’t in the catalog itself.

Unfortunately, in many cases, the simplest solution but also less "elegant" is to copy the files to include in the folder of our OSDesign (operating system solution) and change the corresponding BIB file to set inclusion into the final NK.bin. Indeed, in many cases you can choose the inclusion at BSP level and not in terms of individual OSDesign, affecting in this way all the projects generated from the same BSP. Sometimes, we need to add some changes to the REG file if the component needs some registry settings and add changes to the DAT file if you need to create links to the component out of the \Windows folder (where all system files are stored by default). Finally, you have to add a custom build action that allows you to copy the file from our directory (which is OSDesign or BSP) in the release directory, to allow the inclusion into the final NK.bin.

The most "elegant" solution is to create a SubProject through the Platform Builder and perform all the above steps using its configuration file (BIB, REG, DAT, ..) as well as the batch file for the custom actions. It is also possible to associate to it a catalog file so that our component is shown into the catalog items, enabling a third-party developer to include it trivially in the OS image.

All these steps are repetitive and it would be useful to have a tool that automates them for us; this tool exists and it is called "Windows Embedded Compact (CE) Component Wizard" (known as CEComponentWiz)​​. It was developed by Samuel Phung and David Jones and it is available on CodePlex and makes the whole process extremely simple.

Let’s install CEComponentWiz

We have two installation modes: as a tool accessible from the Tools menu of Visual Studio 2012 or as PB script accessible from the Tools -> Platform Builder menu. In the first case, at the end of installation we need to add manually the tool to the menu as follows:

  1. Select “External Tools” from Tools menu in Visual Studio 2012;
  2. Add the new tool and set the following :
    1. title (ex. CEComponentWiz)
    2. select executable from installation folder;
    3. set $(ProjectFileName) $(ProjectDir) as argument (pay attention to the backspace between parameters);
    4. set $(TargetDir) initial directory;

In this way, the tool will be visible in the menu and can be activated once you have selected the operating system design from the Solution Explorer.


In the second case, you install a PB script file in the PBScripts folder under  MyDocuments which has the task of launching the CEComponentWiz through Visual Studio 2012. To enable this script you need to start it for the first time via the Tools -> Platform Builder -> Configure Scripts menu. Once executed, it will be available in the same menu as Active Scripting and you can run.


Let’s create M2Mqtt component

To use the CEComponentWiz tool you need to open a OSDesign project in Visual Studio 2012 and then launch the tool itself. In addition, we have to prepare the material that will include generated component. In this case, we have to get the assembly of M2Mqtt library compiled for .NET Compact Framework 3.9.

Start the tool and through the GetContent –> Modules menu, select the file to be included (in this case M2Mqtt.dll); in the case of an assembly for the .Net Compact Framework 3.9 we need to ensure that it is included in the FILES section of the BIB file and that the flag "C" (compressed) is enabled. Having to register the assembly in the GAC you need to change the name to the following:


In addition, using CEComponentWiz we are able to set the registry keys necessary to register the assembly into the GAC as follows:

    "M2Mqtt, Version=, Culture=neutral, PublicKeyToken=974d508d5b9f76a5"=multi_sz:"\\windows\\GAC_M2Mqtt_v3_0_0_1_cneutral_1.dll","M2Mqtt.dll"

    "M2Mqtt, Version=, Culture=neutral, PublicKeyToken=974d508d5b9f76a5"=multi_sz:"\\windows\\GAC_M2Mqtt_v3_0_0_1_cneutral_1.dll","M2Mqtt.dll"

Create a .reg file containing the keys listed above (eg M2Mqtt_registry.reg) and add this file through the GetContent -> Registry Entries menu.


Using the Generate Component  Project -> Component Details menu, you can set the project name, a description, a comment and producer. In addition, through the voice OS Version we have to set 8.00 value in the case of Windows Embedded Compact 2013. Clicking on Generate Development Component, the tool creates a subproject within the current folder of the OS Design with all necessary configuration files.

At this point we can add it manually (using Add existing subproject) to the OS design but the tool provides us the additional functionality of creating a component in the WINCE800\3rdParty directory. In this way, if we display the catalog items and execute the refresh, we would have our component that can be included with a simple click!


With this post we built a custom component for Platform Builder that we can distribute to anyone who wants to include the M2Mqtt library in its operating system image, so it is onboard without the need of having to distribute with your application.