1.6-preview3 compile error: System.InvalidOperationException : !!! error : ExternalLibrary `%OutputFileName%` not found. ABORTING.

276 views
Skip to first unread message

Mathew Burkitt

unread,
Jun 15, 2022, 7:24:49 AM6/15/22
to Excel-DNA

I just upgraded from Excel-DNA 1.51 to 1.6-preview3 as part of upgrading a very large C# solution from .NET 4.8 to .NET 6.

The upgrade has worked perfectly with Microsoft's Upgrade Assist tool; only 1 or 2 very small code-changes were needed.  I am very impressed by this.

However the ExcelDNA project in the solution fails to build for some kind of config reason with the following compiler output:

15>ExcelDnaPack: bin\Debug\net6.0-windows\DDD.ExcelAddIn-AddIn.dna -> bin\Debug\net6.0-windows\DDD.ExcelAddIn-AddIn-packed.xll

15>Using base add-in C:\Users\mb\source\repos\DDD\DDD.ExcelAddIn\bin\Debug\net6.0-windows\DDD.ExcelAddIn-AddIn.xll

15>  ->  Updating resource: Type: CONFIG, Name: __MAIN__, Length: 13522

15>  ~~> ExternalLibrary path DDD.ExcelAddIn.dll resolved to C:\Users\mb\source\repos\DDD\DDD.ExcelAddIn\bin\Debug\net6.0-windows\DDD.ExcelAddIn.dll.

15>  ->  Updating resource: Type: DNA, Name: __MAIN__, Length: 554

15>  ->  Updating resource: Type: ASSEMBLY_LZMA, Name: DDD.EXCELADDIN, Length: 36014

15>Completed Packing bin\Debug\net6.0-windows\DDD.ExcelAddIn-AddIn-packed.xll.

15>ExcelDnaPack: bin\Debug\net6.0-windows\DDD.ExcelAddIn-AddIn.xll.config -> bin\Debug\net6.0-windows\DDD.ExcelAddIn-AddIn-packed.xll.config

15>ExcelDnaPack: bin\Debug\net6.0-windows\ExcelDna-Template.dna -> bin\Debug\net6.0-windows\ExcelDna-Template-packed.xll

15>Using base add-in C:\Users\mb\source\repos\DDD\DDD.ExcelAddIn\bin\Debug\net6.0-windows\ExcelDna-Template.xll

15>  ->  Updating resource: Type: CONFIG, Name: __MAIN__, Length: 13522

15>System.InvalidOperationException : !!! error : ExternalLibrary `%OutputFileName%` not found. ABORTING.

15>   at ExcelDnaPack.PackProgram.PackDnaLibrary(Byte[] dnaContent, String dnaDirectory, ResourceUpdater ru, Boolean compress, Boolean multithreading)

15>   at ExcelDnaPack.PackProgram.Pack(String[] args)

15>   at ExcelDnaPack.PackProgram.Main(String[] args)

15>C:\Users\mb\.nuget\packages\exceldna.addin\1.6.0-preview3\build\ExcelDna.AddIn.targets(230,5): error MSB3073: The command ""C:\Users\mb\.nuget\packages\exceldna.addin\1.6.0-preview3\build\..\tools\\net452\ExcelDnaPack.exe" "bin\Debug\net6.0-windows\ExcelDna-Template.dna" /Y  /O "bin\Debug\net6.0-windows\ExcelDna-Template-packed.xll"" exited with code 1.

15>Done building project "DDD.ExcelAddIn.csproj" -- FAILED.


Steps I took to try to fix this:
  • Searched the source code for "ExternalLibrary", "%OutputFileName%" and "ABORTING" - found nothing.
  • Searched this Google Group and StackExchange - found nothing relevant

The original 1.51 compiles and runs fine.

Where and how should OutputFileName be created?  In what config file, in what section?  I imagine it should be created automatically but apparently not.

If anyone knows what this error means and how to fix it I would be very grateful.

Mathew Burkitt
UK







Govert van Drimmelen

unread,
Jun 15, 2022, 8:51:09 AM6/15/22
to exce...@googlegroups.com

Hi Mathew,

 

It looks like, in addition to your add-in’s .dna file, another .dna file (the ‘template’ file) might be found in your project directory.

This is the ‘ExcelDna-Template…’ bit you see.

Inside the template.dna it has the replacement hole `%OutputFileName%` that you see mentioned.

 

It’s not a problem I’ve seen reported before, so it might be a leftover from an earlier installation that was ignored previously, or something is a bit different in your environment.

 

So I suggest just checking for some stray file like that, else write back and we’ll dig further.

 

-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/743c63fa-aafd-40f9-bee6-67e19613c2e6n%40googlegroups.com.

Mathew Burkitt

unread,
Jun 15, 2022, 11:36:42 AM6/15/22
to Excel-DNA
Hey Govert,

Thanks so much for the helpful and quick reply!

OK you are right - I found four .dna files in the path <SolutionRoot>\DDD.ExcelAddIn\bin\Debug\net6.0-windows\ like this
  • DDD.ExcelAddIn-AddIn.dna
  • DDD.ExcelAddIn-AddIn64.dna
  • ExcelDna-Template.dna
  • ExcelDna-Template64.dna

The content of the third one ExcelDna-Template.dna is copied here and yes it does have the %OutputFileName% parameter in it:

<?xml version="1.0" encoding="utf-8"?>
<DnaLibrary Name="%ProjectName% Add-In" RuntimeVersion="v4.0" xmlns="http://schemas.excel-dna.net/addin/2020/07/dnalibrary">
  <ExternalLibrary Path="%OutputFileName%" 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.

       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.
  -->
</DnaLibrary>


STEPS TO REPLICATE
  • Virgin Windows 11 machine; fresh install of VS2022 and .NET 6 (yesterday)
  • Machine is new & used so far only for the .NET6 upgrade task, away from my main development machine
  • No special config applied - just defaults
  • Clone Git repository and run Microsoft's .NET 6 Upgrade Assist tool in non-interactive mode
  • Update solution packages for .NET 6
  • Fix two minor lines of code that broke (in 300k!)
  • Excel-DNA build error occurs + come here to this forum

Any ideas what I need to do now?

Thanks again,

Mathew

Mathew Burkitt

unread,
Jun 15, 2022, 11:44:52 AM6/15/22
to Excel-DNA
Ha, I found that file in the project directory (assembly, not solution) and deleted it - and now the solution builds absolutely perfectly.

My compliments; I though upgrading to .NET 6 would be a one-month full-time project but it turns out it was just a few hours.

Thanks!
Reply all
Reply to author
Forward
0 new messages