Search code examples
c#visual-studio-2013windows-store-appswinrt-component

How to implement a Brokered Component: Windows Store App


Using the instructions from here: http://visualstudiogallery.msdn.microsoft.com/527286e4-b06a-4234-adde-d313c9c3c23e

Running Visual Studio 2013 as Admin with Update 2.

I create a C# BWRC project, TestBwrc. In Class.cs I add an int property that returns 1.

I add a new project to the solution, a C++ Brokered Windows ProxyStub called TestBwrc.Ps.

I add a reference to the TestBwrc project, and set project Linker properties to Register Output.

I then build the solution.

I add a new project to the solution, a C# blank windows store app, called TestBwrc.Client. I add a reference to the TestBwrc.Ps project. Solution builds with no errors or warnings.

In the App.xaml.cs OnLaunched method I add TestBwrc.Class c = new TestBwrc.Class(); Visual Studio complains "Cannot resolve symbol 'Class'" Solution builds with no errors or warnings.

Running the app throws an exception, TestBwrc.Class is not registered.

What am I missing?

Edit:

Also on TestBwrc.Client I added the Extensions tag to the app manifest with the ClassId of TestBwrc.Class and path Value of "..\Debug\TestBwrc.Ps"


Solution

  • The problem is the path Value of "..\Debug\TestBwrc.Ps" in the ActivateableClassAttribute as mentioned in my edit. Though %ProgramFiles% will be expanded, .. is not, nor is $(SolutionDir). So the for dev the only value that works is C:\dev\TestBwrc\Debug\TestBwrc.Ps

      <Extensions>
        <Extension Category="windows.activatableClass.inProcessServer">
          <InProcessServer>
            <Path>clrhost.dll</Path>
            <ActivatableClass ActivatableClassId="TestBwrc.Class" ThreadingModel="MTA">
              <ActivatableClassAttribute Name="DesktopApplicationPath" Type="string" Value="C:\dev\TestBwrc\Debug\TestBwrc.Ps" />
            </ActivatableClass>
          </InProcessServer>
        </Extension>
      </Extensions>