Error calling all UDFs when application is published

110 views
Skip to first unread message

IVÁN TORRES SEBATIANES

unread,
Feb 16, 2023, 2:46:14 AM2/16/23
to Excel-DNA

Hello,

 

We are developing a VSTO Add-in for Excel (.NET Framework 4.7.2) in C# and we decided to use your library to be able to create User Defined Functions and include them in excel as it were a formula. 

We can execute in Excel, debugging code in Visual Studio (2017), the custom functions that we have created and they appear correctly. 

The problem we have is when we publish the Add-in and install it, when we run it, we lose the list of functions and Excel can't find them. 

We've tried many different things but couldn't get it right.

We even tried to make a direct call to the methods containing the references to your library, and in that case we get the attached error.

 ERROR.PNG

 

I would greatly appreciate the help provided.

 

All the best.

Govert van Drimmelen

unread,
Feb 16, 2023, 3:01:04 AM2/16/23
to exce...@googlegroups.com

--------------------------------------------------
Excel-DNA is now registered on 
GitHub Sponsors.
A small once-off or monthly contribution encourages support and further development.
--------------------------------------------------

 

You need to establish whether the problem is with running the add-in on the other machine, or with your installation.

If you are distributing the “packed” .xll file, then it might be that you have some dependencies that are not being packed.

If you are distributing as an .xll file, .dna file with loose dependencies, you need to be sure all the pieces are getting installed.

 

(But the file ExcelDna.Integration.dll need never be distributed, the correct copy that Excel-DNA needs is already embedded in the .xll file.)

 

I suggest:

  • Make a directory on your development machine.
  • Copy only the files you are distributing – the packed .xll or the loose files.
  • Check that the add-in works on your machine.
  • Copy this whole directory to the target machine.
  • Check if the add-in works on the target machine.
  • Compare with the directory where your installer put the files – are there any differences?

 

-Govert

 

 

 

From: 'IVÁN TORRES SEBATIANES' via Excel-DNA <exce...@googlegroups.com>
Sent: Thursday, February 16, 2023 9:46 AM
To: Excel-DNA <exce...@googlegroups.com>
Subject: [ExcelDna] Error calling all UDFs when application is published

 

Hello,

 

We are developing a VSTO Add-in for Excel (.NET Framework 4.7.2) in C# and we decided to use your library to be able to create User Defined Functions and include them in excel as it were a formula. 

We can execute in Excel, debugging code in Visual Studio (2017), the custom functions that we have created and they appear correctly. 

The problem we have is when we publish the Add-in and install it, when we run it, we lose the list of functions and Excel can't find them. 

We've tried many different things but couldn't get it right.

We even tried to make a direct call to the methods containing the references to your library, and in that case we get the attached error.

 

 

I would greatly appreciate the help provided.

 

All the best.

 

"Este mensaje está dirigido de manera exclusiva a su destinatario y puede contener información privada y confidencial. No lo reenvíe, copie o distribuya a terceros que no deban conocer su contenido. En caso de haberlo recibido por error,  rogamos lo notifique al remitente y proceda a su borrado, así como al de cualquier documento que pudiera adjuntarse.

 Por favor tenga en cuenta que los correos enviados vía Internet no permiten garantizar la confidencialidad de los mensajes ni su transmisión de forma íntegra.

 Las opiniones expresadas en el presente correo pertenecen únicamente al remitente y no representan necesariamente la opinión del Grupo BBVA."

 "This message is intended exclusively for the adressee and may contain privileged and confidential information. Please, do not disseminate, copy or distribute it to third parties who should not receive it. In case you have received it by mistake, please inform the sender and delete the message and attachments from your system.

 Please keep in mind that e-mails sent by Internet do not allow to guarantee neither the confidentiality or the integrity of the messages sent."

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/68310851-158a-4564-9700-2bced04882den%40googlegroups.com.

image001.png

IVÁN TORRES SEBATIANES

unread,
Feb 16, 2023, 4:20:53 AM2/16/23
to Excel-DNA
Thanks for answering.

Do you mean an Excel Add-in?

We use a COM Add-in (VSTO) for Excel that when published in visual studio creates an .exe installation file (Clickonce).

All the best.

Govert van Drimmelen

unread,
Feb 16, 2023, 4:34:37 AM2/16/23
to exce...@googlegroups.com

Hi Ivan,

 

VSTO and Excel-DNA does not really interoperate.

You can’t make a single add-in which mixes VSTO libraries and Excel-DNA libraries and exposes UDF functions.

UDF functions are exposed from the Excel-DNA .xll add-in only.

The Excel-DNA libraries like ExcelDna.Integration should not be referenced from a VSTO project.

VSTO libraries like Microsoft.Office.Tools.XXXX should not be used from an Excel-DNA project.

However, the normal COM interop libraries in namespaces Microsoft.Office.Interop.Excel etc. are OK to use from Excel-DNA.

 

The options are thus:

  • Put all the functionality into the Excel-DNA add-in, including macros, ribbons etc. (Nearly) everything that you can do with VSTO can also be done with Excel-DNA, though sometimes a bit more work. The exception is the magic binding to a specific workbook.
  • Alternatively, have two completely separate add-ins, made with VSTO and Excel-DNA. Then set up the VSTO add-in to automatically load the Excel-DNA .xll add-in by calling Application.RegisterXLL.

 

I suppose you are trying the second path, and trying to distribute the Excel-DNA based .xll add-in together with the VSTO add-in in a single installation package. That should work OK, if you are sure all the pieces you need from the Excel-DNA .xll add-in are included in the installation. I have not done this myself, but you will have to find a way to include the outputs from the Excel-DNA project, including the .xll file(s) for 32-bit and 64-bit add-ins, into the VSTO installation package.

 

My checks were intended to verify that the right bits are arriving at the target machine after installing.

IVÁN TORRES SEBATIANES

unread,
Feb 17, 2023, 7:56:44 AM2/17/23
to Excel-DNA
Hello Govert,

I have tried as you told me and it works fine. I have added the 64.bit .xll file created with the UDFs with Application.RegisterXLL and it is picked up correctly by Excel without the need to add it manually.


Thanks so much for the help!

All the best.
Reply all
Reply to author
Forward
0 new messages