Share via

C# Runtime Error - Diamond dependency when using Microsoft.Graph.Core (Microsoft.Kiota.Abstractions)

Andy Guinan 30 Reputation points
2023-05-26T11:26:05.56+00:00

Hi guys,

I've run into an issue whilst developing an SSIS package that's intended to automatically distribute emails using a Microsoft Graph connector. I'm using a Script component to perform the communication using C# and referencing the Microsoft.Graph and Azure.Core assemblies.

I've used the code given at https://learn.microsoft.com/en-us/graph/sdks/create-client?tabs=CS to build a basic "Hello world" email to myself and upon build of the project, there are no issues.

When executing the package however, I get the following error:

[Main()] Error: Could not load file or assembly 'Microsoft.Kiota.Abstractions, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Accoding to NuGet, there is a diamond dependency going on here:

  • Microsoft.Graph.Core (3.0.6) > Microsoft.Kiota.Authentication.Azure (>=1.0.2) > Microsoft.Kiota.Abstractions (>=1.1.0.0)
  • Microsoft.Graph.Core (3.0.6) > Microsoft.Kiota.Abstractions (>=1.1.1.0)

To try and combat this, I've added references to Microsoft.Kiota.Abstractions (1.1.1.0) in the following ways:

  • Added a direct item to the References tree of the Vsta project:

User's image

  • Added the explicit version reference to the Packages.config file:
<?xml version="1.0" encoding="utf-8" ?>
<packages>
  <PackageReference Include="Microsoft.Kiota.Abstractions" Version="[1.1.1.0]" />
</packages>
  • Added it to the app.config file as an Assembly Binding:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.Kiota.Abstractions" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="0.0.0.0-1.1.1.0" newVersion="1.1.1.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

When I execute the package, I still get the same error even with all of these references in place.

This is the log from ProcessMon which shows version 1.1.1.0 is successfully loaded and then an attempt to load 1.1.0.0 is made (I'm assuming Microsoft.Graph.Core directly references it and then Microsoft.Kiota.Authentication.Azure attempts to load 1.1.0.0 afterwards) - Also maybe worth noting that I've installed all assemblies to the GAC which is why these filepaths are being referenced.

User's image

I've read and attempted many different fixes from both the Microsoft documentation and through other user forums over the past few days in order to resolve the issue but to no avail.

Are there any areas that I may be overlooking here, like could there be some subtle nuance with me using the assembly as part of an SSIS script component that is causing incompatibility?

SQL Server Integration Services
Microsoft Security | Microsoft Graph
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


Answer accepted by question author

Olaf Helper 47,616 Reputation points
2023-06-02T10:08:01.3766667+00:00

.NET core framework is not supported by SSIS script task.

See Script Task => Writing and Running the Script that the Task Uses

Currently we dont support .NET Core and .NET standard assembly references.

Was this answer helpful?

1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.