1

As exactly described here Cannot reference .NET Core library from UWP, im receiving the same exception.

"System.IO.FileLoadException" in Project.exe

Exception

UWP-Projectfile

{
  "dependencies": {
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
    "Microsoft.Xaml.Behaviors.Uwp.Managed": "1.1.0",
    "Newtonsoft.Json": "9.0.1",
    "Template10": "1.1.11"
  },
  "frameworks": {
    "uap10.0": { "imports": "netstandard1.6" }
  },
  "runtimes": {
    "win10-arm": {},
    "win10-arm-aot": {},
    "win10-x86": {},
    "win10-x86-aot": {},
    "win10-x64": {},
    "win10-x64-aot": {}
  }
}

.Net-Core Projectfile

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

Another strange thing happening is this:

Strange inline error Resharper

Notes

For my Core-Dll, i did not make an Nuget-package, but referenced it like in the old days.

The project is nothing special. I've used the Template 10 pack and updated all packages via Nuget.

Without referencing my own .dll, everything works and no errors are popping.

Do i really have to make a package for all and everything im going to develop and want to source out in a seperate .dll?

Community
  • 1
  • 1
lokusking
  • 7,396
  • 13
  • 38
  • 57

1 Answers1

1

netstandard1.6 isn't supported by UWP. Only netstandard1.4 is. Make sure the class library targets netstandard1.4 if you want to use it in UWP.

When you added "imports": "netstandard1.6" to the UWP project you're making a statement that you don't care about compatiblility rules and you're going to try to use the netstandard1.6 asset even though it isn't supported by your framework.

TheESJ
  • 2,357
  • 17
  • 13
  • So basically your're saying, i cannot use UWP with .NET Core 1.0? But that doesnt match the fact, that i can compile UWP-App with this framework: `"frameworks": { "uap10.0": { "imports": "netstandard1.6" } },` – lokusking Aug 03 '16 at 17:02
  • .NET Core 1.0 supports netstandard1.4 as well, so if you build a portable library that is netstandard1.4 it will work in both. I'll restate that using "imports" does not constitute support. That's just telling NuGet you want to try it an see if it works. NuGet will first try and find the right asset from packages that supports the framework you are targeting (uap10.0), only if it doesn't find any supported asset will it then consider the imported framework. You can put *anything* in imports, including `net46` which, for instance, would allow you to use a library that depends on WPF. – TheESJ Aug 03 '16 at 18:04
  • If you could provide an workaround for this as answer in addition, i'd be **very** happy since i cannot select NETStandard 1.4 as downgrade within Visual Studio. Neither i can find it on Nuget-Web. For clearance: I was just playing around with with UWP and thought, *Hey lets try .Net Core* so this is a trivial play-project – lokusking Aug 03 '16 at 18:48