1

I Created a simple .Net class library using VS2017 and windows 10 and changed the output type to winmdobj as stated in this msdn guide: https://learn.microsoft.com/en-us/windows/uwp/winrt-components/brokered-windows-runtime-components-for-side-loaded-windows-store-apps but after that I build the code and it errors with:

Platform Attribute 'Windows.Foundation.Metadata.ActivatableAttribute' is either defined in an assembly that is not referenced or does not have the expected constructor. Please ensure that your assembly references include the .NET Framework and Windows Runtime platform assemblies, such as System.Runtime.dll and Windows.winmd.

I added a reference to System.Runtime.dll and Window.winmd but still giving me the same error

Am I using the wrong references? Any help please?

Tariq
  • 31
  • 5
  • Have you looked at the [Desktop Bridge](https://learn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-root)? It lets you re-use your existing desktop code in a UWP package without all those custom steps, although you don't get to use strongly-typed WinRT objects to communicate. – Peter Torr - MSFT Mar 04 '18 at 01:49
  • @PeterTorr-MSFT we already have Win8.1 Store App that we use as our POS and it connects to a brokered components to perform silent printing and other functions not available in WinRT APIs , I already converted the App to UWP and every thing works fine except the brokered component where some of the methods works as querying the available printers and there are others that do not work as printing silently , so i decided to to rewrite the brokered component using the link mentioned in the questions but I encountered that error. my understanding that the brokered component is the solution to go. – Tariq Mar 06 '18 at 02:47
  • OK I will see if anyone here can help. – Peter Torr - MSFT Mar 10 '18 at 21:53

1 Answers1

0

Tariq, what are the references in your csproj, and which Windows SDK do you have installed? I had to add a reference to System.Runtime.InteropServices.WindowsRuntime, and the correct Windows.WinMD (the one that is 5mb, not the façade that is only 370kb).

  • System.Runtime.InteropServices.WindowsRuntime
  • C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.16299.0\Windows.winmd

-Adam