Use nuget packages in script task

Viewed 645

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");
    }   
}
1 Answers
Related