'How to auto build Excel-DNA addin in VS 2019

I am trying to auto pack Excel-DNA project.

I have followed Getting Started with Excel-DNA to create Excel-DNA project.

I followed Excel-DNA Packing Tool to pack my project which works.

I am trying to use VS 2019 post-build event to achieve auto pack my project.

I copied the ExcelDna.Integration.dll,ExcelDnaPack.exe and ExcelDnaPack.exe.config to my folder, and then use command below

ECHO "Start Deploy"
"$(SolutionDir)Distribution\ExcelDnaPack.exe" "$(TargetDir)$(TargetName)-AddIn.dna" /Y /O "$(TargetDir)DeployMeekou.ExcelCOM.xll"

But, it create the expected file. But, I got this file is invalid when I try to load it from Excel.

And checking build output, this is the output

1>  "Start Deploy"
1>  Using base add-in C:\Users\xx\Meekou.ExcelCOM\bin\Debug\Meekou.ExcelCOM-AddIn.xll
1>  System.ComponentModel.Win32Exception: The parameter is incorrect
1>     at ResourceHelper.ResourceUpdater.RemoveResource(String typeName, String name)
1>     at ExcelDnaPack.PackProgram.Pack(String[] args)
1>     at ExcelDnaPack.PackProgram.Main(String[] args)

Here are my project folder

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source