This package contains project templates used to created Brokered Windows Runtime Components and their Proxy Stubs, which enables side-loaded modern applications to communicate with pre-existing desktop components. This solution works on Windows 10 or later version with Visual Studio 2015
It contains two project templates: 1. A C# project template for you to create the Desktop Windows Runtime components that are used to bridge modern application and pre-existing desktop code. 2. A C++ project template to generate the IPC proxy stub that will be used in your modern application. For more details about the Brokered Windows Runtime Component, please review whitepaper on MSDN: http://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx
Here is a brief guidance on how to use the template to create a brokered WinRT component: 1. Create a new Brokered WinRT Component using the Templates -> Visual C# -> Brokered Windows Runtime Component (Let’s call thisBrokeredComponent) 2. Make updates to Class.cs (change file name if needed) to define the component. 3. Add a new project to the existing solution to create proxy/stub for this using the Templates -> Visual C++ -> Brokered Windows Runtime ProxyStub. (Let’s call thisBrokeredProxyStub) 4. Add project reference on the BrokeredProxyStub project to depend onBrokeredComponent. 5. Build the entire solution to see if the build is successful. 6. Run regsvr32 to register the BrokeredProxyStub.dll found in$(SolutionDir)\[Debug|Release] folder.This step can be omitted if you perform steps described in NOTE. 7. Create a Windows Store C# App in the same solution. 8. Add a reference in C# App project to the reference assembly generated by the BrokeredProxyStub project. In Reference Manager dialog, Click "Browse..." button and look for the reference assembly .winmd file in <BrokeredProxyStubProjectRoot>\Debug\Reference\<winmd file name>. 9. Update the AppxManifest to specify where the definition of the Brokered component is using this XML <Extensions> < ExtensionCategory="windows.activatableClass.inProcessServer"> <InProcessServer> <Path>clrhost.dll</Path> <ActivatableClassActivatableClassId="[Fully Qualified Name of Brokered Component]"ThreadingModel="MTA"> <ActivatableClassAttributeName="DesktopApplicationPath"Type="string"Value="[Path to location of Brokered Components and ProxyStub]" /> </ActivatableClass> </InProcessServer > </Extension> </Extensions> 10. Update code in the Windows Store C# App to use the brokered WinRT Component 11. Run the Store App and see the code run
NOTE: If you run Visual Studio as Administrator and mark the Proxy/Stub to register automatically using “project/properties/Linker/General/Register Output” of BrokeredProxyStub project (shown below) then things are 100% automatic. i.e. Step 6 is no longer required.
|