Error calling ExcelDnaPack.exe

Feb 13, 2015 at 2:02 PM
Hi, first time user, I just pulled the source down and built it, then have built a simple HelloWorld app. I've basically replicated the steps from the nuget package, but using only binaries that I built myself.
  1. Added a reference to ExcelDna.Integration.dll
  2. Added a post-build event command-line to copy <package>\tools\ExcelDna\ExcelDna.xll to your output directory as
    <ProjectName>-AddIn.xll. This is the add-in loader for your Excel add-in.
  3. Another command is also added to run the Excel-DNA packing tool ExcelDnaPack.exe to create a single-file
    redistributable, called <ProjectName>-AddIn-packed.xll.
  4. Added a file called <ProjectName>-AddIn.dna to your project, set to be copied to the output directory (same name
    as the .xll). This is the configuration file for your Excel add-in.
  5. Configured <ProjectName>-Addin.dna to load your project library as an add-in library, and pack the compiled library
    into the redistributable.
  6. Configured debugging to start Excel and load the <ProjectName>-AddIn.xll.
I then inserted a sample function.

Everything works fine, except that the call to ExcelDnaPack.exe fails, but only when it's run in the Post-Build event - it succeeds if I run from a command prompt, but not if it runs from the post-build event. I get the following error:

" exited with code -532459699

Any ideas?
Feb 13, 2015 at 3:14 PM
Hi, I found the problem, I was doing a Debug build of ExcelDnaPack.exe and that has a Console.ReadKey call in a #if DEBUG section - built as Release, everything works fine now.

The moral of the story - build ExcelDnaPack.exe as a Release build if you plan to run it in a post-build event...
Marked as answer by Cronan on 2/13/2015 at 8:14 AM