Using .NET Core packages on Windows 8.1?


#1

Hi, I’m looking for help. I have a legacy .NET PCL that targets the following platforms:

  • .NET Framework 4.5
  • Windows 8
  • Windows Phone 8.1

I also have a newer project, using the new Class Library (Package) template in VS2015, that’s based off DNX and project.json. I want to use this package in my legacy PCL. Of course, this means my new package has to support all the platforms the old one does.

So I go into my project.json, and according to the table here I should add the dotnet TFM to target .NET Core, net45 to target .NET 4.5, and netcore45 to target Windows Store apps. Adding the first 2 monikers work just fine, but when I add netcore45 I suddenly get a wave of errors about how System.Void, System.String, System.Object, etc. etc. are not defined.

tl;dr

  1. Create a new “Class Library (Package)” project in VS2015.

  2. Double-click project.json and change dotnet to netcore45.

  3. BAM! 14 errors right out of the box. Even if you change System.Runtime to 4.0.0 (which is compatible with Windows 8) and get rid of the other dependencies, you still get errors about how built-in types are not defined.

Is there a solution to this problem without having to retarget the legacy PCL to Windows 10?

edit: original StackOverflow question


#2

Finally solved it, after 6 hours!

The key is to change dependencies to frameworkAssemblies.

Sigh… the ASP.NET 5 documentation needs to be a lot better. What’s even more misleading is that VS doesn’t autocomplete when you type in frameworkAssemblies, so you assume you’re doing something wrong.

Thank you to whoever created this project!


.NET Foundation Website | Blog | Projects | Code of Conduct