2

Please note that we are building an app to run on Windows 10, but when we check in the code we are getting these build errors

C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(268, 9): error MC1000: Unknown build error, 'Cannot resolve dependency to Windows Runtime type 'Windows.Foundation.Metadata.PlatformAttribute'. When using the ReflectionOnly APIs, dependent Windows Runtime assemblies must be resolved on demand through the ReflectionOnlyNamespaceResolve event.'  

It looks like these items are missing on Windows Server 2012 R2 version 6.3 since these are our build servers, but the app is targeted to Windows 10, so there must be some other deeper-down COM modules missing:

C:\WINDOWS\System32\WinMetadata\Windows.Foundation.winmd 
C:\WINDOWS\System32\WinMetadata\Windows.Devices.winmd 

Does anyone have any suggestions? TIA

UPDATE:

Please note that I have spent a lot of time researching and troubleshooting the issue. Here are a few links I've found, but they have not resulted in a solution:

Unknown build error Cannot resolve dependency to System.Windows

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/b6209e45-642f-4542-a66e-f304cf8baaf2/regasm-quotcannot-resolve-dependency-to-windows-runtime-type-for-net-dll?forum=visualstudiogeneral

Reflecting a WinRT executable from a .Net 4.x App

https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/how-to-load-assemblies-into-the-reflection-only-context

user8128167
  • 6,929
  • 6
  • 66
  • 79

1 Answers1

1

Rather than digging through and trying to find the COM differences, we just went with creating a Windows 10 build server.

UPDATE:

The other option would be to upgrade the build server from Windows 2012 to 2016.

user8128167
  • 6,929
  • 6
  • 66
  • 79
  • 1
    I am getting the same error. In my case, I am using windows 10 project (with toast notication, ...) in my windows 8.1 system. Is that by any means be the reason for that? Because the same project can be cloned and run in another windows 10 project. – Naveen Kumar V Jun 25 '19 at 16:42
  • 1
    I think the issue is that your Windows 10 project requires certain modules like Windows.Devices.winmd that are only found on Windows 10. So even if you are working with a "Win 10" project in Visual Studio it will not work because of the missing dependencies. – user8128167 Jun 26 '19 at 22:14