Max
Max

Reputation: 3583

Convert a PCL to a regular Class Library

I currently have a Portable Class Library whose code is entirely compatible with a regular Class Library without any modification.

I was wondering if there was an existing software to do the conversion automatically ; I looked into the Visual Studio tools but could not find any suitable. Before writing my own I just wanted to be sure!

Upvotes: 21

Views: 6018

Answers (2)

obaylis
obaylis

Reputation: 3034

The differences will be in your .proj file.

Having tried it myself you will have to do all of the following;

  1. Remove the <TargetFrameworkProfile> element
  2. Remove the <ProjectTypeGuids> element
  3. Change where you have #2 (below) for what I shown in #1

1. Regular class library

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

2. Portable class library

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

Upvotes: 56

Martin
Martin

Reputation: 61

Use VSCommands, it has as a build in functionality to convert Projects to PCL. Right mouse click on Project and convert. It´s free and part of Visual Studio extensions http://vscommands.squaredinfinity.com/Features-SolutionExplorer

Update 2016-10-12: Above link is dead. The tool has been rewritten for Visual Studio 2015 and can be found here: https://visualstudiogallery.msdn.microsoft.com/c84be782-b1f1-4f6b-85bb-945ebc852aa1

Upvotes: 6

Related Questions