Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change a PCL into a .net Platform Standard Library in Visual Studio 2017?

I am trying to figure out how to change a portable .net class library into a .net platform standard library. There is a clickable link in the project settings that looks right it says "Target .net platform standard".

target .net platform

The error which seems absurd to me is:

The project's targets cannot be changed. The selected targets require the project to opt-into NuGet 3.0 support, however, Visual Studio cannot automatically do this for you. Please uninstall all NuGet packages and try again.

Is there any way to do this that makes more sense than the absurd approach above of literally deleting all my references and then trying to add them back? I don't know how to take this project which I didn't write and convert it to to .net standard other than write all the references down on a piece of paper and then try to add them back again. Is that literally what I'm being told to do? Is there another way? Am I doing this wrong?

Secondly, even when I remove all references that can be removed, the project still won't convert. I removed Newtonsoft and all other references that can be removed, leaving only .net, system, and system.core, which are not removable.

I still get the same absurd error. The project I'm trying to modify is an open source project available on github, but I'm purposely trying to make this question more general so it could be useful to others who run into this "Target .net platform standard doesn't work at all" issue.

like image 796
Warren P Avatar asked Nov 28 '16 18:11

Warren P


People also ask

What is the difference between .NET Standard and PCL portable class libraries?

NET Standard is a set of curated APIs, picked by Microsoft, PCLS are not. The APIs that a PCL contains is dependent on the platforms that you choose to target when you create a PCL. This makes a PCL only sharable for the specific targets that you choose.

What is .NET PCL?

Article. 07/12/2021.


1 Answers

Same here

I struggled a lot with the exact same problem: The solution which worked best was the one provided by @Jasper H Bojsen

So I had to:

  • create a new project regarding the namespaces I was using in the pcl
  • ReNuggetManageDownloadPackagesReferences
  • and poof it compiled and I had no error
like image 188
Nathan Smiechowski Avatar answered Oct 05 '22 23:10

Nathan Smiechowski