Excel Addin code upgrade to .NET 7 core Initialization Fails

142 views
Skip to first unread message

Daksh Desai

unread,
Mar 22, 2024, 12:16:09 PM3/22/24
to Excel-DNA
Hey Govert,

Hope you are doing well!!

I have onboarded the upgrading train and upgraded my Excel Addin code to .NET 7 core.

The steps that I followed are 

I have C# wrapper nuget package for our C++ code, I first upgraded that to .net 7.

Then I  upgraded the Excel Addin code to .net 7 and also upgraded the ExcelDna.AddIn and ExcelDna.Addin.Integration to 1.8.0-alpha3.

But I am getting below error while loading the Addin.

Initialization [Error] No objects loaded from Excel.Analytics_x64, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.




Govert van Drimmelen

unread,
Mar 22, 2024, 12:22:28 PM3/22/24
to Excel-DNA
All the steps you describe sound fine.

The error message you see is a new one that we show when no functions, ribbon extensions etc. are found when loading the main ExternalLibrary.
For example, if the assembly can't be loaded because it targets a mismatched runtime, you'd get that. But there might be other reasons related to your add-in.

Is 'Excel.Analytics_x64.dll' your main C# assembly?

Maybe start with a simple add-in, and grow it back to your full add-in.
Or you can contact me directly to arrange for an online support session.

-Govert



Daksh Desai

unread,
Mar 22, 2024, 2:19:45 PM3/22/24
to Excel-DNA
Hey Govert,

Thanks for the quick response,

This is how my app.config looks,

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Dynamic" publicKeyToken="7f709c5b713576e1" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Scripting" publicKeyToken="7f709c5b713576e1" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-1.2.0.0" newVersion="1.2.0.0" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.2.0.1" newVersion="4.2.0.1" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="CommonServiceLocator" publicKeyToken="489b6accfaf20ef0" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.0.5.0" newVersion="2.0.5.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" /></startup></configuration>

Do you think the <startup> could be the issue.

Govert van Drimmelen

unread,
Mar 22, 2024, 2:30:43 PM3/22/24
to exce...@googlegroups.com

The .config file will not be used at all when targeting .NET 7.

 

-Govert

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/ad5abd5a-e126-4270-847d-30a101e47af5n%40googlegroups.com.

Daksh Desai

unread,
Mar 22, 2024, 4:03:00 PM3/22/24
to Excel-DNA
I think I have found the issue in my C++ wrapper build, I use Cake to build that and somehow the MSBuild is targeting the correct framework while building the nuget package and builds for .NET Framework and not .NET core 7.0.
I am not sure how I can make MS Build via Cake to build specifically for .net core 7.0.

Any pointers on that?
Reply all
Reply to author
Forward
0 new messages