8
votes

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?

2
You need the .dll from the component too. When the component is compiled, it must generate a .winmd file and a .dll file.kiewic
Unfortunately that's not the case - no dll is generated. The output files include a .winmd, .pri, and .pdb.Jesse Johnston
Hey Jesse, did you ever find a solution to your issue?Jason Anderson

2 Answers

9
votes

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>
1
votes

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