Search code examples
excel-dna

Error with ExcelDna - File does not exist (Xll32FilePath): ExcelDna.xll


I've successfully used ExcelDna in the past (when one had to manually amend the .dna file and copy the XLLs), but I cannot get the ExcelDna.Addin (downloaded via Nuget) working.

I followed the instructions of the readme.txt file and get the following error,

Error DNA1899655818 File does not exist (Xll32FilePath): ExcelDna.xll

FWIW, I also have the following warning in Visual Studio,

Warning NU1701 Package 'ExcelDna.Integration 1.7.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETStandard,Version=v2.1'. This package may not be fully compatible with your project.

This is the full content of the .proj file,

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="ExcelDna.AddIn" Version="1.7.0" />
  </ItemGroup>
</Project>

This is the content of the launchSettings.json file,

{
  "profiles": {
    "Excel": {
      "commandName": "Executable",
      "executablePath": "C:\\Program Files\\Microsoft Office\\root\\Office16\\EXCEL.EXE",
      "commandLineArgs": "/x \"MyFuncs-AddIn64.xll\""
    }
  }
}

I followed the instructions exactly and just can't get this to work.

My system config is,

  • VS Community 2019
  • MS Office 2021
  • Target Framework: .NET Standard 2.1

The previous version of ExcelDna I used (I think 1.1, with the manual file copying for .dna and .xll) I had working with the same version of VS but with Excel 2013.

Any help/thoughts appreciated.


Solution

  • The Excel-DNA packages don't support the .NET Standard target framework.

    To use .NET 4.0, amending the TargetFramework line in the .proj did the trick,

    <TargetFramework>net48</TargetFramework>