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.
Install the Microsoft update for Office 2003 (KB907417). Refer to http://support.microsoft.com/default.aspx/kb/907417.
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>
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.
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 Miscorosft'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:
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.
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.