The type "Windows.UI.Xaml.FrameworkElement" is defined in an assembly that is not referenced

I have a UWP application that I am trying to create. Everything works fine in debug mode, but when I switch to release and then try to build, it shows an error

error CS0012: The type "Windows.UI.Xaml.FrameworkElement" in the assembly that is not referenced is set. You must add a reference to the assembly 'Windows.Foundation.UniversalApiContract, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null, ContentType = WindowsRuntime'.

I limited it to a project property called the "Compile with.NET Native tool chain", which is the source of the problem. At least a project can build when I remove this property. However, I would prefer to enable this option. I have added links to the extensions of Windows Desktop and Windows Mobile.

Any idea what I need to do to fix this?

+4
source share
3 answers

After contacting Matt, he and his colleagues found that it was a bug in the .NET Native. So I just need to wait for the next .NET Native update.

EDIT: Visual Studio 2015 ( 3) .NET! !

+1

Windows Universal. , . Windows 10 SDK, !

0

I answered a similar question. Are you using an XmlSerializer to serialize a type that references the winmd type? In your case, the winmd type looks like "Windows.UI.Xaml.FrameworkElement"? If yes, please look at my answer to this question. It seems that .Net native tools have problems generating XmlSerializer for types that reference winmd types.

0
source

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


All Articles