You can specify additional .dll libraries to pack by adding an ‘ExcelAddInInclude’ property in your project file, with a ‘;’-separated list of assemblies to pack.
Or you can set it up so that all .dll files in the output directory are packed into the publish\-packed .xlls.
To do this you add an extra target in your project file to build the ‘ExcelAddInInclude’ property automatically
<Target Name="PackedReferences" AfterTargets="AfterBuild" BeforeTargets="ExcelDnaBuild">
<ItemGroup>
<References Include="$(OutDir)*.dll" Exclude="$(OutDir)$(TargetFileName)"/>
</ItemGroup>
<PropertyGroup>
<ExcelAddInInclude>@(References)</ExcelAddInInclude>
</PropertyGroup>
</Target>
Yes, I think they would be packed – you can see full details of the packing in the build output.
If you don’t want some of the .dll files in the output directory to be packed, then you either need to change the ‘PackedReferences’ target specification somehow, or just explicitly list all the libraries that you do want to pack in an <ExcelAddInInclude> list, without having the extra Target etc.
I also suggest you change the invalid TargetFramework moniker from
<TargetFramework>net4.6.2-windows</TargetFramework>
to something like
<TargetFramework>net472</TargetFramework>
See Target frameworks in SDK-style projects - .NET | Microsoft Learn
Some of the Excel-DNA libraries already require .NET Framework 4.7.2 or later, and that’s the oldest version still supported by Microsoft.
So I’d suggest targeting 4.7.2 instead of 4.6.2. The “-windows” platform suffix is only used for .NET core versions (.NET 6.0+).
-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 visit https://groups.google.com/d/msgid/exceldna/22b9233c-c496-449e-bef4-fc4c96d61346n%40googlegroups.com.
If you don’t pack the extra assemblies, you will have to copy them next to the -packed.xll for it to work.
Are there errors when you use METAS UncLib under .NET Framework 4.7.2?
On Windows the .NET Framework version gets updated automatically, and has very high compatibility.
You also cannot have .NET Framework 4.6.2 installed alongside a newer .NET Framework 4.x version.
I ask because the next Excel-DNA version will only support .NET Framework 4.7.2+ and I would like to know if there are real issues with this.
To view this discussion visit https://groups.google.com/d/msgid/exceldna/b1871381-ae29-4653-b0da-899c58b17b9an%40googlegroups.com.
Okay, yes, it is definitely possible to exclude the NationalInstruments*.dll files from being packed.
You can achieve this by modifying the Exclude attribute within the ItemGroup definition for References. The Exclude attribute can accept multiple patterns, separated by semicolons (;).
Here's how you can modify your Target:
Explanation:
The @(References) item list passed to the ExcelAddInInclude property will now contain all DLLs from the output directory except your main project DLL and any National Instruments DLLs.