could not load file or assembly 'system, version=2.0.5.0'

3

Sep

Intro

Recently I encountered an issue whereby attempting to deploy a project which contained a Portable Class Library (PCL) resulted in the following error:

System.IO.FileLoadException: Could not load file or assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes' or one of its dependencies. 
	

We had gone to the extent of building our project to target .NET framework 4.0 and had assumed this would work on any server with .NET 4.0 installed unfortunately this is not the case.

The original fear was that the sever would require .NET framework 4.5 installed, which was not possible. Fortunately this was not the case.

After some investigation it turns out that this is caused by the System.Core dll being updated as part of a .NET framework update which the server did not have installed (automated updates were turned off).

The following Microsoft KB article KB2468871 details feature 5 as:

Changes to the support portable libraries. These changes include API updates and binder modifications. This update enables the CLR to bind successfully to portable libraries so that a single DLL can run on the .NET Framework 4, on Silverlight, on Xbox, or on the Windows Phone. This update adds public Silverlight APIs to the .NET Framework 4 in the same location. The API signatures will remain consistent across the platform. All modifications are 100 percent compatible and will not break any existing code.

Applying the framework update, which did not require a server reboot and restarting IIS is sufficient to remove the error and allow PCL's to work on an older server.

It's also worth knowing that this update is included as part of VS2010 SP1 and above.

Comments
add comment
Captcha