Iris Classon
Iris Classon - In Love with Code

Creating and using brokered components step by step video

Brokered components were introduced at BUILD 2014 and allows us to make use of legacy DLLs without much problems (heh). The VS templates came out aprox a month after BUILD, and before that there was a fair deal of manual work involved, I tried it and it was a pain. However, the templates make it rather easy, or easier.

Here is a step by step video with some rambling, which is what you get when your record demos at midnight after a week with very little sleep.

The best example I could come to think of, and I don’t even know if this is the best example, is simply using the file watcher and output changes to a directory in the Windows Store App.

The way it works is that the brokered component allows us to use any DLL (more or less), which means that the Store app won’t be able to use it directly as there is a missmatch between the platforms they are built for.

This is solved by creating a proxy that in turn can reference the component and allow the Store application to call the component.

The Store application has to add an extension in the manifest and register the proxy DLL as well as classes that it will be using, and the DLL has to be registered.

Steps:

Install VS extension

Create Store app

Create Brokered Component – do magic in it

Create Proxy – add reference to component (right click, properties, common properties, add reference)

 

Add reference to proxy from Store app

Build solution

Add Extension in Store manifest file, register class and add path to Proxy DLL

Run regsvr32 from elevated prompt and path to proxy DLL

Run and have fun.

Some more links:

Brokered components in detail

http://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx

VS extension

http://visualstudiogallery.msdn.microsoft.com/527286e4-b06a-4234-adde-d313c9c3c23e

BUILD

http://channel9.msdn.com/Events/Build/2014/2-515video

BUILD video demo

http://channel9.msdn.com/blogs/HarryPierson/Brokered-WinRT-Components-Wake-On-Callback-Demo

Detailed step by step by awesome Harry

http://devhawk.net/2014/04/25/brokered-winrt-components-step-one/

Harry Pierson on Twitter

https://twitter.com/DevHawk

 

 

 

 

 

 

 

Comments

Leave a comment below, or by email.
Matthew Lawson
8/9/2014 12:26:46 PM
Hey,

(Maybe a stupid question) I might just be confusing the name WinRT to ARM devices instead of the actual "runtime". Does this only apply to WinRT (ARM) devices or can I use the same thing with writing x64 Windows Store Apps?

Regards,
Matt 
Adalid
10/13/2014 3:33:23 PM
Hi Iris , I try to build a component Brokered and read all the references you posted , but I can not make it work , I always get the following errors:

* Class unregistered

or
*An exception of type 'System.TypeLoadException' occurred in ClientRT.exe but was not handled in user code

BTW, hardly knew you, but you're amazing Xb, I currently work with a Microsoft partner and looked very far being MVP, but you have inspired me even more.

Thank you .
Greetings !! 


Last modified on 2014-06-09

comments powered by Disqus