XLL+ Class Library (7.0)

.NET requirements

Developer requirements for add-ins that use .NET

.NET runtime version
You must ensure that the your computer loads the correct version of the .NET run-time. See below.
Primary Interop Assemblies
If your add-in uses the Excel object model, then you must ensure that your machine has the Office Primary Interop Assemblies available. See below.
VS 2005 SP1
If you are using Visual Studio 2005, you must install Service Pack 1.

Run-time requirements for add-ins that use .NET

.NET runtime version
You must ensure that the user's machine loads the correct version of the .NET run-time. See below.
Primary Interop Assemblies
If your add-in uses the Excel object model, then you must ensure that the user's machine has the Office Primary Interop Assemblies available. See below.
C Runtime libraries
Ensure that the target machine has the required runtime DLLs. See Runtime Dependencies for details.

Loading the correct .NET runtime version

By default, Excel will load version 1.1.4322 of the .NET runtime. This will have the effect of making an XLL fail to load, with a message such as "This file is not in a recognizable format".

You can fix the problem in several ways.

  1. Install the Microsoft update for Office 2003 (KB907417). Refer to http://support.microsoft.com/default.aspx/kb/907417.

  2. Create a config file named excel.exe.config and place it in the same directory as EXCEL.EXE. The file should contain a <supportedRuntime> element, as in the following example:

    <configuration>
      <startup>
        <supportedRuntime version="v2.0.50727" /> 
      </startup>
    </configuration>
  3. Locate the following key in the registry, and delete or rename it.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy\AppPatch\v2.0.50727.00000\excel.exe

    Note: extreme care should be taken when editing the registry directly. Refer to support staff as necessary.

Please note that there is normally no need to follow these procedures if Visual Studio 2008 has been installed on a machine, since the installer usually resolves these issues.

With a 64-bit version of Excel, you may find that only the config file technique works.

Office Primary Interop Assemblies

Both developers and users need to have the Office Primary Interop assemblies available on their computers. By default Visual Studio 2008 installs the PIAs for Excel 2003 and Excel 2007. If it is not already installed, you can download the PIAs from Microsoft's web-site. Search the Microsoft web-site for Office Primary Interop Assemblies to find a downloable installer.

The following assemblies are required:

Microsoft.Office.Interop.Excel.dll
Microsoft.Vbe.Interop.dll
office.dll
stdole.dll

The assemblies can be installed in one of two ways:

  1. In the Global Assembly Cache (GAC). You can use the batch program delivered with the assemblies to install them in the GAC. They will be available to all applications.

    This is the simplest and most convenient way to install the assemblies, and is recommended for developers.

  2. Private assemblies. You can deliver copies of the DLLs along with the XLL, in the same directory. This is the approach we have taken with the PiaDemo sample.

Debugging

When you attempt to start the debugger for an add-in that uses .NET code with a 64-bit version of Excel, you may get the error message: "The debugger does not support debugging managed code and native code at the same time on this platform."

In this case you have two options: