LoadImage: System.Drawing.Common is not supported on this platform

202 views
Skip to first unread message

Suki Gill

unread,
Oct 15, 2022, 1:39:05 PM10/15/22
to Excel-DNA
Hi
I've been creating an ExcelDNA addin using v1.6.0 with .Net Core 6.0.

I decided to add some images to my Addin's ribbon.

I used the standard template for doing this.

.dna file

  <ExternalLibrary Path="RibbonCore.dll" ExplicitExports="false" LoadFromBytes="true" Pack="true" IncludePdb="false" />
      <Image Name="connected" Path="Images\AppointmentColor3.png"/>  (my image)
  </DnaLibrary>

.ribbon xml

<?xml version="1.0" encoding="utf-8" ?>
<customUI xmlns='http://schemas.microsoft.com/office/2009/07/customui' loadImage='LoadImage'  >
  <ribbon>
    <tabs>
      <tab id='CustomTab' label='My Tab'>
        <group id='SampleGroup' label='My Sample 2010 Group'>
          <button id='Button1' label='My Button 2010 Label' image='connected' />

          <editBox id='someid' label='Doit' image='connected'  />                              
        </group >
      </tab>
    </tabs>
  </ribbon>
</customUI>


The above works fine and I get an image displayed with the button and editBox.

My Addin hooks into Windows Active directory service, hence I need to make use of the the frameworks
    System.DirectoryServices (6.0.0) - this has a dependency on    System.Drawing.Common (6.0.0) which it installs.
    System.DirectoryServices.AccountManagement. (6.0.0)

As soon as I pull in the above nuget packages it fails to initialise the Ribbon when there are images attached to any of the ribbon controls.

The error I get
    An exception occcured while calling function 'LoadImage'. The exception message is:
    System.Drawing.Common is not supported on this platform.

If I take the above DirectoryServices packages out it works fine.

Regards

Suki

Suki Gill

unread,
Oct 16, 2022, 6:41:33 AM10/16/22
to Excel-DNA
I was able to work around by downgrading to System.DirectoryServices packages to version 4.5.0.

It's still unclear to me why this is happens with 6.0.0 with the target platform being Windows.

turhan

unread,
Mar 30, 2023, 8:13:35 AM3/30/23
to Excel-DNA
If you also face this issue like me, here is more info and suggestions on how to resolve it.
Reply all
Reply to author
Forward
0 new messages