Excel-DNA works when running in Visual Studio. How do I Install the XLL?

130 views
Skip to first unread message

Mitchell Allen

unread,
May 17, 2023, 3:55:37 PM5/17/23
to Excel-DNA
When I go to manage COM Add-ins, Excel either ignores the path or throws various errors. Clearly, I'm just trying different combinations of paths and files, but have no idea how to get the add-in accepted. I compiled a release version and copied the files to a different folder, outside of of the Visual Studio and Excel default locations.

Do I need to put the XLL, DLL and the DNA file in the same folder? 

Govert van Drimmelen

unread,
May 17, 2023, 6:13:13 PM5/17/23
to Excel-DNA
The Excel-DNA .xll add-in is not a "COM Add-In" but an "Excel Add-In".
These are different categories in the Manage: -> ... Add-Ins -> Go ... interface (see picutres below).
You can also reach the Excel Add-Ins list directly, by pressing Alt+t, i from the sheet.

What exactly you need to distribute depends a bit on which Excel-DNA package you're using, and how complicated your add-in is.
For a simple add-in it should work with the three files (your .dll and the .xll and .dna file for the right bitness of your Excel).
If you have other dependencies, you might see those .dll files in the output too, and you also need them to have a workign add-in.

To make distribution easier, as part of the build process, we make XXX-packed.xll and XXX-packed64.xll add-ins, which (if things are configured right) can be a single file distribution of your add-in.
(Well, two single-files, for 32-bit and 64-bit Excel.)
In the latest ExcelDna.AddIn package versions (1.7.0-rc4 is the latest), the packed add-ins go into a "publish" subdirectory of your build output.

To have "things configured right" depends on the .NET version you are targeting, and whether you have your own .dna file in the project.
* When targeting .NET 6, with no .dna file in your project, we'll also include other libraries you need in the packed .xll file.
* When targeting .NET 4.x you need to add some ExcelAddInInclude entries in the project if you want to include extra dependencies.

If you have a .dna file in your project, you might need to add <Reference > tags there for additional dependencies to go into the packing.

We don't have good documentation for this, and it has become a bit tricky over time, in part due to efforts to make things simpler, while keeping compatibility with older behaviour and instructions you might see.
So please ask if you still find anything confusing - I'm happy to exapnd more.

-Govert

AddIns.png
AddIns.png

Mitchell Allen

unread,
May 17, 2023, 8:08:06 PM5/17/23
to Excel-DNA
Thank you very much for the details.

Cheers,

Mitch

Mitchell Allen

unread,
May 17, 2023, 8:12:16 PM5/17/23
to Excel-DNA
That worked a treat! In fact, when I opened the dialog box, the Add-in was sitting there, waiting to be checked as active.
Reply all
Reply to author
Forward
0 new messages