Hi,
I am currently in the process of porting a solution containing 10+ projects from .NET framework 4.5 to .NET 6.
Previously, I have been using ExcelDnaPack.exe to combine each of the projects into a single .xll file to be used as an Excel add-in. I have done this by supplying a custom .dna file to ExcelDnaPack.exe which specifies each of the projects to include in the final .xll file:
<?xml version="1.0" encoding="utf-8"?>
<ExternalLibrary Path="Proj1.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" COMServer="true" />
<ExternalLibrary Path="Proj2.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" COMServer="true" />
<ExternalLibrary Path="Proj3.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" COMServer="true" />
.
.
.
</DnaLibrary>
However, since updating each of the projects to .NET 6, this approach no longer seems to work for me. When I use the ExcelDnaPack.exe tool with the same .dna file, the resulting .xll add-in throws an error when loaded into Excel (see below for an example of this error).
What is the best way to package multiple Sdk-style (.NET 6) projects into a single add-in? Or is that even supported?
---
Excel error (copied from excel sheet):
This add-in is built with Excel-DNA and is being loaded from the following location:
A problem occurred while attempting to load the .NET runtime:s
This error can occur if the .NET framework is not installed.f
Please ensure that the Microsoft .NET Framework 2.0 or later is installed before loading the add-in.B
This error can occur if the .NET runtime is not installed, if version 2.0 or later is not installed, if the AppPatch registry entries are incorrect, or if there is an excel.exe.config configuration file restricting the versions of the .NET runtime that can be loaded by Excel.˜
Please ensure that the Microsoft .NET Framework Version 2.0 or later is installed, and will be loaded correctly by Excel, before reloading the add-in.P
This is an unexpected error. Please report this error to the add-in developer.ZThe .NET runtime was loaded but could not be started:
This is possible if another managed add-in caused the runtime to load, using the incorrectly installed AppPatch policy.ÊReview the other managed Excel add-ins that are loaded, or ensure that the .NET 2.0 runtime loads by setting an appropriate 'supportedRuntime' entry in a configuration file for Excel (Excel.exe.config).NThe Microsoft .NET Framework 2.0, 3.0 or 3.5 was not detected on this machine.D
Additional error information
wThe required version of the .NET Framework is installed but could not be loaded.
No other version is currently loaded.ýReview the other add-ins that are loaded, or ensure that the .Net 2.0 runtime loads by setting an approriate 'supportedRuntime' entry in a configuration file (Excel.exe.config).
You will need to restart Excel to load the correct version of the runtime.
This is possible if a configuration file or another managed add-in forces an older version of the runtime to load (only one version of the runtime can be loaded into the process).
rA problem occurred while the add-in was creating an isolated application domain and loading required assemblies.
$AppDomainSetup could not be created.!ApplicationBase could not be set. AppDomain could not be created.MThe ASSEMBLY 'EXCELDNA.LOADER' could not be found among the add-in resources.?The ExcelDna.Loader assembly could not be loaded from resource.BThe Name for the ExcelDna.Loader assembly could not be determined.4The type ExcelDna.Loader.XlAddIn could not be found.3The ExcelDna.Loader.XlAddIn.Initialize call failed.{This Excel add-in requires the Microsoft .NET Framework 4.
A problem occurred while attempting to load the .NET runtime:[
Please ensure that the Microsoft .NET Framework 4 is installed before loading the add-in.ª
This problem usually indicates that the Microsoft .NET Framework 4 is not installed on this computer.+
A problem occurred while attempting to load the requested version of the Microsoft .NET runtime:
If no version is specified in the <addin>.dna file, the host will attempt to load .NET version 2.0.
To load version 4, add a RuntimeVersion='v4.0' attribute to the DnaLibrary tag in the <addin>.dna file.3
Please ensure that the correct version of the Microsoft .NET Framework is requested by the add-in and that the required version is installed.ÊThis Excel add-in requires an '<addin>.dna' configuration file which matched the '<addin>.xll' file.
The required '.dna' file could not be loaded from resources, and was not found in the file system:1
Please ensure that the required '.dna' file exists in the same directory as the '.xll' add-in, and has the correct matching filename.ÑThis Excel add-in requires an '<addin>.dna' configuration file which matches the '<addin>.xll' file (or an embedded resource with the '.dna' file contents).