XLL+ Class Library (6.3)

Building and deployment

Project structure

XLL+ adds new items to your Visual Studio project, in order to implement the import process.

The first added item is an XML file, MyLib.import.xml. This contains instructions on how to import the assembly. When the item is "compiled", the XLL+ Reflector tool is invoked, which:

  1. reads the command line arguments from MyLib.import.xml;
  2. loads up any detailed import instructions that you saved using the Import Editor (from a file named MyLib.xnr);
  3. loads the imported assembly MyLib.dll and reads all its members using reflection;
  4. generates C++ wrapper functions and writes them to MyLib_Wrappers.cpp.

MyLib_Wrappers.cpp is the output of MyLib.import.xml, and therefore it is regenerated whenever MyLib.import.xml is updated. There are are also two "Additional Dependencies" registered with Visual Studio: MyLib.dll and MyLib.xnr. As a result, the C++ code is automatically regenerated whenever the imported .NET DLL is changed and rebuilt, and whenever you use the Import Editor to change the detailed import instructions.

The second item added is MyLib_Wrappers.cpp, which is treated as a standard C++ source file and is compiled and linked into the XLL like any other C++ source file.

Deployment

The following issues are important when running or deploying your XLL add-in.

  1. Your XLL add-in must be able to locate and load the .NET assembly (and its dependent assemblies). See Deploying your .NET assemblies for details.
  2. Excel needs to load the correct version of the .NET run-time. See Loading the correct .NET runtime version for instructions.

Failure to address either of these issues may result in the XLL failing to load and a "This file is not in a recognizable format" message appearing.

Next: Using attributes >>