Use nuget packages in script task
Asked Answered
D

1

6

I am trying to make Microsoft.Azure.Services.AppAuthentication and its dependencies work with SSIS script task. How do I resolve assembly reference errors?

enter image description here


static ScriptMain()
{
    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
}

static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{

    if (args.Name.Contains("Microsoft.Azure.Services.AppAuthentication"))
    {
        return System.Reflection.Assembly.LoadFile(@"C:\Azure\packages\Microsoft.Azure.Services.AppAuthentication.1.6.2\lib\net472\Microsoft.Azure.Services.AppAuthentication.dll");
    }

    if (args.Name.Contains("Microsoft.IdentityModel.Clients.ActiveDirectory"))
    {
        return System.Reflection.Assembly.LoadFile(@"C:\Azure\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.5.2.9\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll");
    }   
}
Diastasis answered 2/3, 2022 at 23:44 Comment(0)
P
7

Nuget packages are not supported in SSIS script task/component. You need to download the assemblies manually from the GitHub repository.

Next, you should add these assemblies to the Global cache assembly (GAC):


You can refer to the following article for more guidance:

Pazpaza answered 3/3, 2022 at 7:1 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.