SSIS Script Task cant find reference to assembly

前端 未结 3 2091
走了就别回头了
走了就别回头了 2020-12-06 18:12

I have an SSIS package that uses a script task to populate a datatable with data from a variety of different file types including excel.

I am using NPOI to read in t

3条回答
  •  粉色の甜心
    2020-12-06 18:51

    static ScriptMain()
            {
                AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            }
            static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
            {
                //(string)Dts.Variables["User::CustomDLL"].Value;
                if (args.Name.Contains("HtmlAgilityPack"))
                {
                    string path = @"C:\Temp\";
                    return System.Reflection.Assembly.LoadFile(System.IO.Path.Combine(path, "HtmlAgilityPack.dll"));
                    //return System.Reflection.Assembly.UnsafeLoadFrom(System.IO.Path.Combine(path, "HtmlAgilityPack.dll"));
                }
                return null;
            }
    

提交回复
热议问题