How to reference Windows.winmd from the .NET Core library?

I am looking for Windows Runtime types, such as Frameor Button, from the .NET Core library. It seemed to work fine when I used the traditional PCL designed for Windows / Windows Phone 8.1. For some reason, however, it does not compile after I switched my project to DNX.

Here is my project.json:

{
    "frameworks": {
        // Profile32 == Windows + Windows Phone 8.1
        ".NETPortable,Version=v4.6,Profile=Profile32": { }
    }
}

And here is my sample code:

using System.Linq;
using Windows.UI.Xaml.Controls;

public class Sample
{
    public void Method()
    {
        Enumerable.Empty<Frame>();
    }
}

I was getting a compiler error on Framein this snippet saying that the type was not found. So, I did a little detective work on this and hit F12 on this in my regular PCL to look at its declaring assembly.

, Windows Runtime Windows.winmd, - Program Files. , .NET Core?

!

( , PCL, , .NET Core.)


meta:. , asp.net-core , DNX.


: :

".NETPortable,Version=v4.6,Profile=Profile32": {
    "frameworkAssemblies": {
        "Windows": { "type": "build" }
    }
}

, , , , , System.Linq System.Runtime.

+1
3

, , .

, csproj xproj, , .

, lib Windows 8.1 Windows Phone 8.1. Windows, :

0

(TFM) .

32 "Windows 8.1, Windows Phone 8.1" (= 1.2).

, , . , , .

, / winmd " ()", ( .NET) dotnet ( ​​.NET),

.NET:

PCL VS2013 VS2015 ( UWP) .NET Platform Standard 1.2.

, .winmd. dotnet51, dotnet52 dotnet53 .NET Core. .NET 4.6 (dotnet54 dotnet55 ) - Windows 8.1, UWP. ( dotnet51 netstandard1.0 dotnet5.5 netstandard1.4))

, ASP.NET Core 1.0 RC2, RC1 dotnet.

, ( , ), , winmd/win8.1 , .

, Class Library (Package) "net" "dotnet" , .NET Core , - "dnx" "dnxcore".

, RC2... ,

+1

Add link to Microsoft.Windows.SDK.Contractsin librarynetcoreapp3.0

0
source

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


All Articles