Addin not working on Excel

165 views
Skip to first unread message

Rayane

unread,
Apr 24, 2024, 5:04:00 AM4/24/24
to Excel-DNA
Hello, 
My addin works fine when I test it using Visual Studio, but when I build it and install the xll into excel, my formulas don't work anymore and I have #Value! instead.
The addin is built upon 4 other assemblies (*.dll), so maybe those are not loading?
I'm unsure where the error come from.
Thanks for your help.
Best regards, 
Rayane

Rayane

unread,
Apr 24, 2024, 7:04:50 AM4/24/24
to Excel-DNA
As a follow up I notice if I install the xll from the 'net472' folder, and not the one from the 'net472\publish' folder, it works. Does it make sense ? Just want to make sure I'm doing things properly.

Govert van Drimmelen

unread,
Apr 24, 2024, 7:20:03 AM4/24/24
to exce...@googlegroups.com

Hi Rayane,

 

By default, under .NET Framework (like the net472 target you’re using) we don’t pack extra files into the  packed .xll that you find in the ‘publish’ folder.

 

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>

 

After adding this, you should see the build output listing all your extra libraries during the packing task, with a few extra lines like this

>    PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: XXXXXXX

 

-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/73bd8228-9b4a-49e7-b7d8-d356319d87bfn%40googlegroups.com.

Rayane

unread,
Apr 30, 2024, 12:36:35 AM4/30/24
to Excel-DNA
Good morning Govert, 

Thank you for the tip. Looks like it is working now with a single file. I will test it on another computer and revert if any problem.

However, I have a follow-up question. When I look at the build log below, there are several lines that seem the same and I was wondering if it was normal (see below blue and green below) ?

In my project file, I have lines as follows under which I copy pasted the code you gave me, and I was wondering if there was no double work here : 

  <ItemGroup>
    <Reference Include="DayCounts">
      <HintPath>..\..\DayCounts\DayCounts\bin\Debug\DayCounts.dll</HintPath>
    </Reference>
    <Reference Include="FinancialInstruments">
      <HintPath>..\..\FinancialInstruments\FinancialInstruments\bin\Debug\FinancialInstruments.dll</HintPath>
    </Reference>
    <Reference Include="GeneralLedgers">
      <HintPath>..\..\FinancialInstruments\FinancialInstruments\bin\Debug\GeneralLedgers.dll</HintPath>
    </Reference>
    <Reference Include="InterestRates">
      <HintPath>..\..\InterestRates\InterestRates\bin\Debug\InterestRates.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.CSharp" />
  </ItemGroup>


Build started...
1>------ Build started: Project: CSAddin, Configuration: Debug Any CPU ------
1>---
1>ExcelDnaSetLaunchSettings: EXCEL.EXE path for debugging: C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE
1>ExcelDnaSetLaunchSettings: Add-In for debugging: bin\Debug\net472\CSAddin-AddIn64.xll
1>CSAddin -> C:\Users\raa\Desktop\CSAddin\CSAXL\CSAddin\bin\Debug\net472\CSAddin.dll
1>---
1>ExcelDnaBuild:  -> bin\Debug\net472\CSAddin-AddIn.dna
1>ExcelDnaBuild: ..\..\..\..\.nuget\packages\exceldna.addin\1.7.0\build\..\tools\\net452\ExcelDna.xll -> bin\Debug\net472\CSAddin-AddIn.xll
1>ExcelDnaBuild: ---
1>ExcelDnaBuild:  -> bin\Debug\net472\CSAddin-AddIn64.dna
1>ExcelDnaBuild: ..\..\..\..\.nuget\packages\exceldna.addin\1.7.0\build\..\tools\\net452\ExcelDna64.xll -> bin\Debug\net472\CSAddin-AddIn64.xll
1>---
1>ExcelDnaPack: bin\Debug\net472\CSAddin-AddIn.dna -> bin\Debug\net472\publish\CSAddin-AddIn-packed.xll
1>PackExcelAddIn: Using base add-in bin\Debug\net472\CSAddin-AddIn.xll
1>PackExcelAddIn:   ~~> ExternalLibrary path CSAddin.dll resolved to bin\Debug\net472\CSAddin.dll.
1>PackExcelAddIn:   ~~> Assembly path DayCounts.dll resolved to bin\Debug\net472\DayCounts.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: CSADDIN, Length: 3515
1>PackExcelAddIn:   ~~> Assembly path FinancialInstruments.dll resolved to bin\Debug\net472\FinancialInstruments.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: DAYCOUNTS, Length: 3351
1>PackExcelAddIn:   ~~> Assembly path GeneralLedgers.dll resolved to bin\Debug\net472\GeneralLedgers.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: FINANCIALINSTRUMENTS, Length: 6979
1>PackExcelAddIn:   ~~> Assembly path InterestRates.dll resolved to bin\Debug\net472\InterestRates.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: GENERALLEDGERS, Length: 3864
1>PackExcelAddIn:   ->  Updating resource: Type: DNA, Name: __MAIN__, Length: 873
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: INTERESTRATES, Length: 2079
1>PackExcelAddIn: Completed Packing bin\Debug\net472\publish\CSAddin-AddIn-packed.xll.

1>ExcelDnaPack: bin\Debug\net472\CSAddin-AddIn64.dna -> bin\Debug\net472\publish\CSAddin-AddIn64-packed.xll
1>PackExcelAddIn: Using base add-in bin\Debug\net472\CSAddin-AddIn64.xll
1>PackExcelAddIn:   ~~> ExternalLibrary path CSAddin.dll resolved to bin\Debug\net472\CSAddin.dll.
1>PackExcelAddIn:   ~~> Assembly path DayCounts.dll resolved to bin\Debug\net472\DayCounts.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: CSADDIN, Length: 3515
1>PackExcelAddIn:   ~~> Assembly path FinancialInstruments.dll resolved to bin\Debug\net472\FinancialInstruments.dll.
1>PackExcelAddIn:   ~~> Assembly path GeneralLedgers.dll resolved to bin\Debug\net472\GeneralLedgers.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: DAYCOUNTS, Length: 3351
1>PackExcelAddIn:   ~~> Assembly path InterestRates.dll resolved to bin\Debug\net472\InterestRates.dll.
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: FINANCIALINSTRUMENTS, Length: 6979
1>PackExcelAddIn:   ->  Updating resource: Type: DNA, Name: __MAIN__, Length: 873
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: GENERALLEDGERS, Length: 3864
1>PackExcelAddIn:   ->  Updating resource: Type: ASSEMBLY_LZMA, Name: INTERESTRATES, Length: 2079
1>PackExcelAddIn: Completed Packing bin\Debug\net472\publish\CSAddin-AddIn64-packed.xll.

========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Build started at 6:25 AM and took 02,672 seconds ==========

Govert van Drimmelen

unread,
Apr 30, 2024, 12:36:54 PM4/30/24
to Excel-DNA
Hi Rayane,

You are seeing the packing task run twice - once for the 32-bit add-in called CSAddin-AddIn-packed.xll and once for the 64-bit add-in called CSAddin-AddIn64-packed.xll.
If you only need the 64-bit add-in, I think you can add this project property:

<ExcelDnaCreate32BitAddIn>false</ExcelDnaCreate32BitAddIn>

-Govert

Rayane

unread,
May 3, 2024, 8:30:27 AM5/3/24
to Excel-DNA
Thanks Govert, very clear.

Excel-DNA is a great tool. I couldn't have dreamt of a better Excel integration. Thanks for all the work you have put into it.

Reply all
Reply to author
Forward
0 new messages