In the previous post, using the tool CEComponentWiz, we have created a custom component that is visible in the Platform Builder catalog items.

We used the assembly of M2Mqtt library compiled for .NET Compact Framework 3.9 and created the corresponding component that I made ​​publicly available on CodePlex under the name M2Mqtt4CE !

M2Mqtt4CE : component description

This component can be useful to any OEM that should produce Windows Embedded Compact 2013 operating system image that has a client for MQTT onboard and  developed with .Net Compact Framework 3.9. Assuming to be OEM, we can download the M2Mqtt4CE package from CodePlex and extract the contents to the \WINCE800\3rdParty folder (as described in the ReadMe.txt file attached).

The main files of the component are the following :

  • M2Mqtt.dll (located in the Resources folder) is the signed assembly of M2Mqtt library that is included in the image and registered in the GAC;
  • M2Mqtt.bib is the BIB file that determines the inclusion of the file M2Mqtt.dll (FILES section) in the image renaming it in GAC_M2Mqtt_v3_0_0_1_cneutral_1.dll for registration in the GAC;
  • M2Mqtt.reg contains the registry keys needed to register the signed GAC_M2Mqtt_v3_0_0_1_cneutral_1.dll assembly in the GAC;

In addition, the file postlink.bat, executed by the build system, making the copy of the file M2Mqtt.dll from Resources directory to the release directory, later to be renamed in GAC_M2Mqtt_v3_0_0_1_cneutral_1.dll (via the BIB file) during the image generation.

Including M2Mqtt into the image

Open an existing project or create a new one using the Wizard in Visual Studio 2012. At the end of the Wizard, open the Platform Builder catalog items; the M2Mqtt component will be visible under the Third Party -> Embedded101 to be included with a simple click !

CEComponentWiz_04_thumb[1]

Click on it and run the build image without forgetting to include the. Net Compact Framework (remember that M2Mqtt library is a managed assembly).

View inside generated NK.bin image file

Not everyone knows that using Visual Studio (from the early versions of Platform Builder), we can open the NK.bin file and view the contents of the file system as well as the registry.

NK_files_thumb[1]

In the "files" section we see the GAC_M2Mqtt_v3_0_0_1_cneutral_1.dll file included as a hidden and system file.

NK_registry_thumb[2]

In the "Registry" section we see the registry settings required for the proper registration in the GAC (like all other .Net Compact Framework assemblies). The assembly is properly signed with a corresponding Public Key Token.

In the next post, we'll talk about another component from Embedded101 family through which provide one of the main tools for debugging on a operating system image (Core Connectivity); it will be useful for the development of a sample application that will use the included MQTT client .