Packaging doesn't seem to work as expected

121 views
Skip to first unread message

Bart Duijndam

unread,
Aug 5, 2020, 12:16:44 PM8/5/20
to Excel-DNA
Hi,

Coming from C++ and XLW I have migrated to C# and Excel-DNA. Building the xll all went OK so far, but now it is time to publish.
I have a slew of third part C# libraries, and I'm trying to have these "packaged".

The packages.config file shows:

<?xml version="1.0" encoding="utf-8"?>

<packages>

<package id="DotSpatial.Positioning" version="2.0.0-rc1" targetFramework="net472" />

<package id="DotSpatial.Projections" version="2.0.0-rc1" targetFramework="net472" />

<package id="DotSpatial.Serialization" version="2.0.0-rc1" targetFramework="net472" />

<package id="DotSpatial.Topology" version="1.9" targetFramework="net472" />

<package id="ExcelDna.AddIn" version="1.1.1" targetFramework="net472" developmentDependency="true" />

<package id="ExcelDna.Integration" version="1.1.0" targetFramework="net472" />

<package id="ExcelDna.IntelliSense" version="1.3.0" targetFramework="net472" />

<package id="ExcelDna.Interop" version="14.0.1" targetFramework="net472" />

<package id="ExcelDna.Registration" version="1.1.0" targetFramework="net472" />

<package id="ExcelDna.Utilities" version="0.1.6" targetFramework="net472" />

<package id="ExcelDnaDoc" version="1.1.0-beta2" targetFramework="net472" />

<package id="GeoAPI" version="1.7.5" targetFramework="net472" />

<package id="GeoAPI.CoordinateSystems" version="1.7.5" targetFramework="net472" />

<package id="GeoAPI.Core" version="1.7.5" targetFramework="net472" />

<package id="MathNet.Numerics" version="4.12.0" targetFramework="net472" />

<package id="MathNet.Numerics.MKL.Win" version="2.4.0" targetFramework="net472" />

<package id="NetTopologySuite" version="2.1.0" targetFramework="net472" />

<package id="System.Buffers" version="4.5.1" targetFramework="net472" />

<package id="System.Memory" version="4.5.4" targetFramework="net472" />

<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />

<package id="System.Runtime.CompilerServices.Unsafe" version="4.7.1" targetFramework="net472" />

</packages>

One by one, I'm adding these to my  dna file :
 

<?xml version="1.0" encoding="utf-8"?>

<DnaLibrary Name="GeoLib Add-In" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2018/05/dnalibrary">

<ExternalLibrary Path="GeoLib.dll" ExplicitExports="true" LoadFromBytes="true" Pack="true" IncludePdb="false" />

<!--

The RuntimeVersion attribute above allows two settings:

* RuntimeVersion="v4.0" - for .NET 4 and 4.5

* RuntimeVersion="v2.0" - for .NET 2.0, 3.0 and 3.5

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 http://excel-dna.net for downloads of the full distribution.

Bart: I've set ExplicitExports="true" (was "false") to avoid non-relevant static functions

from being exported to the compiled help file.

-->

<!-- Bart: These references are c# libraries for documentation & intellisense -->

<Reference Path="ExcelDna.Documentation.dll" Pack="true" xmlns="" />

<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />

<Reference Path="UIAComWrapper.dll" Pack="true" />

<Reference Path="Interop.UIAutomationClient.dll" Pack="true" />

 <!-- Bart: These references are c# libraries required for GeoLib to function properly -->

<Reference Path="DotSpatial.Positioning.dll" Pack="true" />

<Reference Path="DotSpatial.Projections.dll" Pack="true" />

</DnaLibrary>

 
Note that the last two "DotSpatial" libraries do not seem to become packed, as I noted when not including these in the "publish" folder and trying to run Excel from there.
This is being confirmed by the output of the exceldna-unpack utility:
 
Excel-DNA Unpack Tool, version 2.0.0+f8f6f735436747abf091b151e9f1ac8f5aac773f
Analyzing GeoLib-AddIn-packed.xll . . . OK
Extracting EXCELDNA.LOADER.dll (ASSEMBLY) . . . OK
Extracting EXCELDNA.DOCUMENTATION.dll (ASSEMBLY_LZMA) . . . OK
Extracting EXCELDNA.INTEGRATION.dll (ASSEMBLY_LZMA) . . . OK
Extracting EXCELDNA.INTELLISENSE.dll (ASSEMBLY_LZMA) . . . OK
Extracting GEOLIB.dll (ASSEMBLY_LZMA) . . . OK
Extracting __MAIN__.config (CONFIG) . . . OK
Extracting __MAIN__.dna (DNA) . . . OK

The two "DotSpatial" libraries are clearly missing from the packed xll file.
Am I doing something wrong here, or do I overlook some critical setting ?
 
Much appreciate your advice.

Cheers - Bart

 
 
 

Govert van Drimmelen

unread,
Aug 5, 2020, 12:19:18 PM8/5/20
to exce...@googlegroups.com

Hi Bart,

 

I suggest you look at the build output, particularly the output from the ExcelDnaPack task.

 

My guess is that those are mixed or native assemblies, and so are not supported by the current packing mechanism (because .NET does not support loading such assemblies from a memory image).

 

-Govert

--
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/230b6fd4-beb1-411a-8a71-dbd59020ce87o%40googlegroups.com.

Bart Duijndam

unread,
Aug 5, 2020, 12:40:23 PM8/5/20
to Excel-DNA

C. Augusto Proiete

unread,
Aug 5, 2020, 7:06:48 PM8/5/20
to exce...@googlegroups.com
I believe you are experiencing this bug in ExcelDnaPack, which happens when ExcelDnaPack cannot find a file and stops without breaking the build with an error (it does display an error message but doesn't break the build).

You're trying to pack UIAComWrapper.dll and Interop.UIAutomationClient.dll but you don't have any NuGet packages that would bring them to your project in your packages.config, so I'm assuming that these files do not exist in your output folder - that is causing ExcelDnaPack to stop, and it doesn't even get to try packing the DotSpatial.* assemblies.

ps: Unrelated to your specific issue, but you have a lot of assemblies there and some of them are quite large - I'd suggest you disable the default packing during normal build, otherwise your development flow will be quite slow... You can do the packing as a deployment step using a build script (or similar) only at the time of deployment.

Cheers,
C. Augusto Proiete






--

Bart Duijndam

unread,
Aug 6, 2020, 6:33:36 AM8/6/20
to Excel-DNA
Hi Augusto,

You're spot on. 

After removing these two packages both the DotSpatial packages were packed into the xll file. The reason that I had UIAComWrapper.dll and Interop.UIAutomationClient.dll in there, was that in another post a user had Intellisense not working, which was then 'fixed' in the dna file, so I copied all and incorrectly assumed that these two packages would be needed as well.

There are indeed a large number of assemblies in my xll project. Please note I'm still finding my way in the c# world, and quite a few of these packages aren't being used in this xlll at the moment, so I will uninstall these to have a cleaner project. Come November I'll have more time at my hand and could look at the packager 'bug' or other outstanding issues if that would help.

Thanks for your advice !

Bart
To unsubscribe from this group and stop receiving emails from it, send an email to exce...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages