microsoft / dotnet

This repo is the official home of .NET on GitHub. It's a great starting point to find many .NET OSS projects from Microsoft and the community, including many that are part of the .NET Foundation.
https://devblogs.microsoft.com/dotnet/
MIT License
14.38k stars 2.22k forks source link

Blocking UWP Issue Net Native #1266

Closed mandalorianbob closed 3 years ago

mandalorianbob commented 3 years ago

So I am trying to reference a UWP library that references a .NET Standard 2.0 library. The UWP library targets 16299 as the Target and Min version.

Whenever I try to build it in Release or Debug with .NET Native compilation from a 16299 app I get the following:

3>C:\Users\[username]\.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): error : MCG0023: MCG0023:UnresolvableAssemblyReference Unresolvable assembly reference 'Assembly(Name=Windows.Foundation.UniversalApiContract, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime)' found. Please check the references in your build system. A reference is either missing or an assembly is missing an expected type.

This is blocking me pretty hard at the moment. I've tried a lot of different variations of versions of UWP library and/or .NET Native Compiler and nothing seems to make a difference. I've also got a default.rd.xml file in the library with the default

<Directives xmlns="http://schemas.microsoft.com/netfx/2013/01/metadata">
  <Library>
    <Assembly Name="*Application*" Dynamic="Required All" />
  </Library>
</Directives>

in it, and that doesn't seem to help either.

mandalorianbob commented 3 years ago

Oh realized I forgot - I'm using Microsoft Visual Studio Enterprise 2019 Version 16.7.7 VisualStudio.16.Release/16.7.7+30621.155 Microsoft .NET Framework Version 4.8.04084 C# Tools 3.7.0-6.20514.1+600c0dadd199296df3ed07dfabdc014563a77f7c NuGet Package Manager 5.7.0

And I've got the 16299 SDK plus a bunch of other newer SDKs installed. And the UWP library I'm using is 6.2.10

mandalorianbob commented 3 years ago

In making the min-repo, I discovered that it appears to be coming from the Microsoft.Toolkit.Uwp.UI.Controls library. I'll move this issue to there.

I hope for .NET 5, issues like this will have the faulting library including in the output. This is painful to debug.

mandalorianbob commented 3 years ago

For anyone who finds this - https://github.com/windows-toolkit/WindowsCommunityToolkit/issues/3559 I'll close this here.