How to package a Windows Runtime component for distribution?
Asked Answered
P

2

8

I have built a WinRT component (.winmd) for use by both JavaScript and XAML Windows Store apps. When including and referencing the loose .winmd file output in a JavaScript client, I see this build warning:

Microsoft.AppXPackage.Targets(808,9): warning APPX1707: No implementation file was provided for the .winmd file 'myRuntimeComponent.winmd'. To generate registration information in the app manifest, specify the 'Implementation' metadata on the .winmd reference item in the project file.

I can't find any documentation on this error or how to include implementation metadata.

When running the JavaScript client, this exception is thrown when a class method exported from the .winmd is called:

0x80040154 - JavaScript runtime error: Class not registered

Note that I am referencing the loose .winmd file in the client application project, rather than referencing the Visual Studio project that builds the .winmd. My use case is distributing the .winmd output, not the full source for the .winmd component - source distribution is not an option.

Also note that when the Windows Runtime component is referenced as a project reference, the JavaScript client builds and runs correctly. The C# XAML client runs correctly with either a project reference or a reference to the loose .winmd.

It seems as if some registration information is not being generated in the client application build when a loose .winmd is referenced.

How can I build and distribute a loose Windows Runtime component for use by both JavaScript and managed clients?

Pushy answered 25/7, 2013 at 16:49 Comment(3)
You need the .dll from the component too. When the component is compiled, it must generate a .winmd file and a .dll file.Amberly
Unfortunately that's not the case - no dll is generated. The output files include a .winmd, .pri, and .pdb.Pushy
Hey Jesse, did you ever find a solution to your issue?Fulcrum
D
9

A WinRT component built with C# or VB produces a .winmd that contains both metadata and implementation. A component built with C++ provides separate .winmd and .dll files, and the DLL is what contains the details to register the component.

Apparently, as the warning indicates, you need to edit the project file with something like the following to point to the DLL:

<Reference Include="component">
  <HintPath>component.winmd</HintPath>
  <IsWinMDFile>true</IsWinMDFile>
  <Implementation>component.dll</Implementation>
</Reference>
Dacosta answered 2/5, 2014 at 18:54 Comment(0)
N
1

Alternatively you might want to look into Extension SDKs. See the below link for how to package your component as an easy to consume Extension SDK in VS:

http://msdn.microsoft.com/en-us/library/jj127119.aspx

Noel answered 2/5, 2014 at 18:57 Comment(1)
This seems to be the only solution to package a Windows Runtime component that consists of a C++/CX library for multiple architectures. Otherwise Visual Studio will balk at copying the DLL to a mobile device, ignore it, or fail to use it properly.Aedes

© 2022 - 2024 — McMap. All rights reserved.