How to convert a Portable Class Library Project (PCL) to a Full .Net Framework Project

Posted by Blake on 5/29/2014


You need to convert a PCL library to a full version of the framework. You may run into this scenario if you are running code on a server that you cannot patch and is not fully patched with the latest .Net patches. There is a bug where PCL libraries will not run on .Net Framework 4.0 sites that aren’t current in their patching (You will receive an error that goes something like this “Could not load file or assembly, 'System, Version='”).

In an ideal world you would be able to have your hosting service apply KB2468871 ( We don’t always live in an ideal world.

How to change your project from a PCL to a full .Net project:

  1. Open your project file, you can do this in Visual Studio (it should unload the project)
  2. Find the “TargetFrameworkProfile” xml tag and remove it.
  3. Find the “ProjectTypeGuids” xml tag and remove it.
  4. If you are running C#, change “<Import Project="$(MSBuildExtensionsPath32)MicrosoftPortable$(TargetFrameworkVersion)Microsoft.Portable.CSharp.targets" />” to <Import Project="$(MSBuildToolsPath)Microsoft.CSharp.targets" />
  5. If you are running Visual Basic, change “<Import Project="$(MSBuildExtensionsPath32)MicrosoftPortable$(TargetFrameworkVersion)Microsoft.Portable.VisualBasic.targets" />” to <Import Project="$(MSBuildToolsPath)Microsoft.VisualBasic.targets" />
  6. If you are still in Visual Studio (and not using some kind of Notepad) the right click on the project and reload it. It should now be ready to compile under the full version of the Framework. You can now go into the properties and change the target framework to whatever you would like.