Excel-DNA / Excel-DNA/ExcelDna
ExcelDnaPack not working with MSBuildRuntimeType == "Core" and target .NET framework 4.6
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 292
- Avg merge
- 20d 12h
- Merged PRs (30d)
- 1
Description
While trying to port an old project from ExcelDNA 1.1 to ExcelDNA 1.6, I face a weird issue.
If I build with MSBuild then the packed .xll in the publish folder is fully functional and can be loaded by Excel.
If I build with dotnet build my .xll looks broken as it cannot be loaded by Excel. I have a "runtime error '9' : Subscript out of range" just by trying to access one COM object.
I work on Windows 10 / VS 2022, Excel 2016 32 bits right now. I added a reference to nuget ExcelDNA.Addin 1.6 to my project.
My legacy target is .NET framework 4.6 x86/x64. We also aim later for .NET 6.
For these reason and some other reasons I am forced to build with dotnet build.
I found that the xll generation is done with the ExcelDna.AddIn.Tasks.dll which is located under
$(ExcelDnaTasksPath) which partially expands to
- $(ExcelDnaToolsPath)net6.0-windows7.0 for 'dotnet build' according to the MSBuildRuntimeType 'Core'
- $(ExcelDnaToolsPath)net452 for 'msbuild' (MSBuildRuntimeType == 'Full')
My question is : Why is the chosen ExcelDna.Addin.Tasks dll the one in the path net6.0-windows7.0 while my target is .NET framework?
Is there something I can do to fix the xll generation and packing in my project ?
I made a try with Excel DNA 1.7-rc 4 but there is more work than I expected. And as we target production I feel not confident to go with a release candidate.
Contributor guide
Assessment
This issue has not been assessed yet.