I'm looking to use Windows Runtime types, like Frame
or Button
, from a .NET Core library. It seemed to be working fine when I was using a traditional PCL, targeted for Windows/Windows Phone 8.1. For some reason, however, it's not compiling after I switched my project to DNX.
Here's 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 Frame
in this snippet, saying that the type couldn't be found. So, I did a little detective work on this and hit F12 on it in my regular PCL, to look at its declaring assembly.
It turns out that most of the Windows Runtime types I want live in a single assembly called Windows.winmd
, which is found somewhere in Program Files. I'm curious to know, is there any way I can reference this assembly from my .NET Core library?
Thanks!
(Note that I can't just use a regular PCL, since I have needs that are specific to .NET Core.)
meta: By the way, please don't remove the asp.net-core
tag from this question, since this is related to DNX.
edit: I've just tried this:
".NETPortable,Version=v4.6,Profile=Profile32": {
"frameworkAssemblies": {
"Windows": { "type": "build" }
}
}
Unfortunately, this doesn't seem to be working either, although the compiler has no problem resolving assemblies like System.Linq
or System.Runtime
.