DnaCompilation [Error]...?

116 views
Skip to first unread message

Andrew DeBear

unread,
Jul 21, 2023, 6:14:46 PM7/21/23
to Excel-DNA
When debugging and with a release version, once I start Excel, I get this ADD-IN DIAGNOSTIC DISPLAY every time I or Visual Studio starts Excel. Any idea what's causing the error messages? Thanks!

DnaCompilation [Error] There was an error in loading the add-in UDFakhC Add-In (C:\Users\%username%\AppData\Roaming\Microsoft\AddIns\UDFakhC-AddIn64-packed.xll):
DnaCompilation [Error] There were errors when compiling project:
DnaCompilation [Error]     C:\Users\%username%\AppData\Local\Temp\bcxr2swo.0.vb : (0,0) : error BC30035: Syntax error.
(and a long list of "Repeated function...will be overwritten" messages)

When I build the "release" version of the project in MS Visual Studio, it creates the following files in the output folder.

If I copy all of the files into the native MS addins folder, when I open Excel, it tries to load multiple versions of the add-in on top of each other.

..\UDFakhC\bin\Release\
12/23/2021 ExcelDna.IntelliSense.dll
12/23/2021 ExcelDna.IntelliSense.pdb
12/22/2021 ExcelDna.Registration.dll
12/22/2021 ExcelDna.Registration.pdb
07/21/2023 UDFakhC-AddIn-packed.xll
07/21/2023 UDFakhC-AddIn.dna
07/21/2023 UDFakhC-AddIn.xll
07/21/2023 UDFakhC-AddIn64-packed.xll
07/21/2023 UDFakhC-AddIn64.dna
07/21/2023 UDFakhC-AddIn64.xll
07/21/2023 UDFakhC.dll
07/21/2023 UDFakhC.pdb

If I copy the following files into the native MS addins folder, the UDFs seem to work and the intellisense tool tips work.

UDFakhC-AddIn64-packed.xll
ExcelDna.IntelliSense.dll
ExcelDna.IntelliSense.pdb
ExcelDna.Registration.dll
ExcelDna.Registration.pdb

errors.png

Andrew DeBear

unread,
Jul 24, 2023, 2:38:10 PM7/24/23
to Excel-DNA
OK. I looked at my *.dna file. And there was a c# comment line ("//"), instead of an XML comment line ("<!-- -->"). So that fixed the compilation error messages, BUT...

I still get the diagnostic Display box with a bunch of DOUBLED "repeated function" errors...like the add-in is being loaded twice.

Any input appreciated...?

Registration [Error] Repeated function name: 'C_MMatch' - previous registration will be overwritten.
Registration [Error] Repeated function name: ' C_MMatch  ' - previous registration will be overwritten.

excel001.png

Govert van Drimmelen

unread,
Jul 24, 2023, 3:12:53 PM7/24/23
to exce...@googlegroups.com

If you’re using the ExcelDna.Registration library, and registering the functions yourself, then you should put

 

    <ExcelAddInExplicitRegistration>true</ExcelAddInExplicitRegistration>

 

as a property in the project file, or if you have a .dna file in your project,

 

    <ExternalLibrary Path="xxxx.dll" ExplicitRegistration="true" … />

 

in the .dna file.

 

This stops the function registration that Excel-DNA normally does, so that your explicit registrations are not duplicates.

 

-Govert

 

From: exce...@googlegroups.com <exce...@googlegroups.com> On Behalf Of Andrew DeBear
Sent: Monday, July 24, 2023 8:38 PM
To: Excel-DNA <exce...@googlegroups.com>
Subject: [ExcelDna] Re: DnaCompilation [Error]...?

 

OK. I looked at my *.dna file. And there was a c# comment line ("//"), instead of an XML comment line ("<!-- -->"). So that fixed the compilation error messages, BUT...

I still get the diagnostic Display box with a bunch of DOUBLED "repeated function" errors...like the add-in is being loaded twice.

Any input appreciated...?

Registration [Error] Repeated function name: 'C_MMatch' - previous registration will be overwritten.
Registration [Error] Repeated function name: ' C_MMatch  ' - previous registration will be overwritten.

 

--
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/c0bebb06-5cd6-4020-a4ea-22cabc0fc893n%40googlegroups.com.

image001.png

Andrew DeBear

unread,
Jul 24, 2023, 6:47:52 PM7/24/23
to Excel-DNA
Thanks for the response, Govert, but I'm still having trouble with this.

I already had an ExplicitRegistration declaration in my *.dna file, as well as an ExcelRegistration.GetExcelFunction().ProcessParamsRegistrations() declaration in my AutoOpen() Method.

If I edit my *.dna file:
FROM: <ExternalLibrary Path="UDFakhC.dll" ExplicitRegistration="true" LoadFromBytes="true" Pack="true" />
TO: <ExternalLibrary Path="UDFakhC.dll" ExplicitRegistration="false" LoadFromBytes="true" Pack="true" />

Then the number of Registration [Error]'s is cut in half, but it still has errors. AND there are still TWO custom ribbons that are loaded.

When I look at the Build Output in Visual Studio, I THINK it is showing that two DLLs are being packed in the XLL file(s).

Does it look like I'm reading the output correctly? And, if so, what file/declaration should I be looking for to stop that DLL from being packed twice?

Thanks!

Build started...
1>------ Build started: Project: UDFakhC, Configuration: Debug Any CPU ------
1>  ---
1>  ExcelDnaSetDebuggerOptions: EXCEL.EXE path for debugging: C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE
1>  ExcelDnaSetDebuggerOptions: Add-In for debugging: bin\Debug\UDFakhC64.xll
..........
1>  ExcelDnaPack: bin\Debug\UDFakhC64.dna -> bin\Debug\UDFakhC64-packed.xll
1>  Using base add-in C:\Users\~\UDFakhC\bin\Debug\UDFakhC64.xll
1>    ~~> ExternalLibrary path UDFakhC.dll resolved to C:\Users\~\UDFakhC\bin\Debug\UDFakhC.dll.
1>    ~~> ExternalLibrary path UDFakhC.dll resolved to C:\Users\~\UDFakhC\bin\Debug\UDFakhC.dll.
1>    ->  Updating resource: Type: DNA, Name: __MAIN__, Length: 723
1>    ->  Updating resource: Type: ASSEMBLY_LZMA, Name: UDFAKHC, Length: 8510
1>    ->  Updating resource: Type: ASSEMBLY_LZMA, Name: UDFAKHC, Length: 8510
1>  Completed Packing bin\Debug\UDFakhC64-packed.xll.
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


Govert van Drimmelen

unread,
Jul 25, 2023, 2:43:19 AM7/25/23
to exce...@googlegroups.com

Can you show the whole .dna file and the whole .vbproj file?

Andrew DeBear

unread,
Jul 25, 2023, 9:39:19 AM7/25/23
to Excel-DNA
I AM AN IDIOT!
I only just noticed the extra "External Library declaration at the top of the file. That's why it was getting double-packed.

I merged the two and now everything is working as expected.

Thankyou very much for your help.

-Andrew-

<?xml version="1.0" encoding="utf-8"?>
<DnaLibrary
Name="UDFakhC" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2020/07/dnalibrary">
  <ExternalLibrary Path="UDFakhC.dll"
ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />

  <!--
       The RuntimeVersion attribute above allows only the following setting:
       * RuntimeVersion="v4.0" - for .NET 4.5 or higher

       You can have IntelliSense (autocomplete) and validation for this file.
       See https://github.com/Excel-DNA/ExcelDna/tree/master/Distribution/XmlSchemas/

       Additional referenced assemblies can be specified by adding 'Reference' tags.
       These libraries will not be examined and registered with Excel as add-in libraries,
       but will be packed into the -packed.xll file and loaded at runtime as needed.
       For example:

       <Reference Path="Another.Library.dll" Pack="true" />

       Excel-DNA also allows the XML for ribbon UI extensions to be specified in the .dna file.
       See the main Excel-DNA site at https://excel-dna.net for downloads of the full distribution.
  -->


<!-- Configure the project for Explicit Registration - to allow for variable number of parameters (params array) -->

<ExternalLibrary Path="UDFakhC.dll" ExplicitRegistration="false" LoadFromBytes="true" Pack
="true" />

</DnaLibrary>
Reply all
Reply to author
Forward
0 new messages