Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a Portable Class Library (PCL) to a normal class library?

I have a Portable Class Library (PCL) that needs conversion to a normal class library (targeted only at .NET 4.5).

I've tried editing the .csproj file, with no success. I'm wondering how to do this?

like image 626
Contango Avatar asked Aug 18 '15 14:08

Contango


People also ask

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

NET Standard is platform-agnostic, it can run anywhere, on Windows, Mac, Linux and so on. PCLs can also run cross-platform, but they have a more limited reach. PCLs can only target a limited set of platforms.

What is a portable class library?

The Portable Class Library project enables you to write and build managed assemblies that work on more than one . NET Framework platform. You can create classes that contain code you wish to share across many projects, such as shared business logic, and then reference those classes from different types of projects.

How do I create a .NET standard class library?

Right-click on the solution in Solution Explorer and select Add > New Project. On the Add a new project page, enter library in the search box. Choose C# or Visual Basic from the Language list, and then choose All platforms from the Platform list. Choose the Class Library template, and then choose Next.


1 Answers

Got it! I reversed the instructions here:

http://geekswithblogs.net/imilovanovic/archive/2012/08/31/vs2012---how-to-manually-convert-.net-class-library-to.aspx

Delete this from the .csproj file:

<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

And change this ...

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

... to this:

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Update

See Convert a PCL to a regular Class Library.

like image 193
Contango Avatar answered Sep 24 '22 13:09

Contango