0

I've developed a net core library app and posted on nuget for personal use.

Then later I created a universal windows app and tried to install this net core library via nuget then I get the following error.

Package restore failed. Rolling back package changes. 

My net core library app dependencies are netcore app version 1.1

The good thing about netcore app is that I can compile, unit test and update on mac which I use frequently but then I've to develop windows app as well down the road.

Developer
  • 924
  • 3
  • 14
  • 30

1 Answers1

2

For maximum portability, your class library should target .NET Standard, not .NET Core.

Targeting .NET Core means that your class library will be able to run on .NET Core only, and not on the .NET Framework, Mono, etc.

Check out the compatibility chart in the .NET Core documentation. It says that if you target any version of .NET Standard up to 1.4, that will allow you to target the Universal Windows Platform version 10 onwards.

If you need to target earlier versions or other frameworks, you can do so by multi-targeting your .NET Standard class library.

Community
  • 1
  • 1
Gigi
  • 28,163
  • 29
  • 106
  • 188
  • I see. Can you please help on how to create .net standard 1.4, I mean which template should I select from visual studio. The only option I see is once I create is netframework 4.5 or 4.6.1. I don't see anywhere netstandard option. Pictures screenshot appreciated. – Developer Apr 02 '17 at 17:27
  • @Developer, there is clearly .NET Standard Class Library template in VS 2017. – Lex Li Apr 02 '17 at 18:31
  • Ok. Allow me to dig more. Question I'm using Concurrent Dictionary List etc. in my code. Are they supported in netstandard? – Developer Apr 02 '17 at 18:32
  • Yes, such basic classes are immediately available. – Gigi Apr 02 '17 at 20:11