How to pack a Runtime Windows component for distribution?

I created a WinRT component (.winmd) for use in JavaScript and XAML applications for the Windows Store. When you enable and reference the free output of the .winmd file in the JavaScript client, I see this build warning:

Microsoft.AppXPackage.Targets (808.9): Warning APPX1707: File with .winmd file 'myRuntimeComponent.winmd not provided. To create registration information in the application manifest, specify the "Implementation" metadata in the .winmd reference element in the project file.

I cannot find documentation about this error or how to include implementation metadata.

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

0x80040154 - JavaScript runtime error: class not registered

Please note that I refer to the free .winmd file in the client application project, and not to the Visual Studio project that creates the .winmd. My use case is distributing the .winmd output rather than the full source for the .winmd component - the 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 works correctly. The C # XAML client works correctly with a link to a project or a link to a free .winmd.

It seems that some login information is not created in the client application assembly when referencing the .winmd link.

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

+6
source share
2 answers

A WinRT component built using C # or VB creates a .winmd that contains both metadata and an implementation. A component built using C ++ provides separate .winmd and .dll files, and a DLL is what contains the data for registering the component.

Apparently, as follows from the warning, you need to edit the project file with the following link to point to the DLL:

<Reference Include="component"> <HintPath>component.winmd</HintPath> <IsWinMDFile>true</IsWinMDFile> <Implementation>component.dll</Implementation> </Reference> 
+5
source

Alternatively, you can look in the Extension SDK. See the link below on how to pack your component as an easy-to-use SDK extension in VS:

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

+1
source

Source: https://habr.com/ru/post/950286/


All Articles