English

Error: Could not load file or assembly 'filename' or one of its dependencies; This assembly is built by a runtime newer than the currently loaded runtime

Error Message

After starting ArcGIS Explorer, the Add-In Error dialog box displays the following error message:

"Could not load file or assembly 'file:///C:\Users\<User Name>\AppData\Roaming\ESRI\ArcGIS Explorer\AddIns\Cache\<Add-in Name>\<Assembly Name>.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

Cause

ArcGIS Explorer 900 and 1200 required .NET Framework version 2.0 (SP2) and used MSBuild 2.0 to specifically target this version. The MSBuild toolset version was specified explicitly in the Visual Studio 2008 ArcGIS Explorer project templates by way of the ToolsVersion attribute on the Project element in the project file (<Project ToolsVersion="2.0" ... </Project>). The ArcGIS Explorer 1500 SDK requires .NET Framework version 3.5 Service Pack 1, but when converting an ArcGIS Explorer 900 or 1200 Add-in project from Visual Studio 2008 to Visual Studio 2010, the MSBuild toolset version specified in the project file is left unchanged. After conversion, the resulting add-in actually targets the .NET Framework 4.0 instead of 3.5.

Solution or Workaround

This error can be resolved using the steps below.

  1. Open Windows Explorer and navigate to the project file (<...>.csproj or <...>.vbproj) of the ArcGIS Explorer 900/1200 project that is to be upgraded to Visual Studio 2010.
  2. Open the project file in a text editor such as Notepad.
  3. At the top of the file, find the Project element and change the ToolsVersion attribute value to "3.5" (including the quotation marks). The entire line should now look like that below:

    Code:
    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  4. Next find the TargetFrameworkVersion element and change its value to v3.5. The entire line should now look like that below:

    Code:
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

  5. Save the file.
  6. Now open the solution in Visual 2010, use the Visual Studio Conversion Wizard to upgrade the project to Visual Studio 2010 format, and build the add-in as normal.

Related Information