PnP.Framwork for SSIS Script Task

Siva Mani 6 Reputation points
2021-06-15T09:05:40.72+00:00

I am working on a requirement - Upload files to SharePoint using Client Id and Secret. I struct at Nuget package usage in SSIS Script Task.

Here what I have tried,

Copied all the DLLs to a location and used below code,

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

private System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
string strAssemblies_Location = @"C:\Users\siva.m\Documents\SSIS Helper Packages\2.0\";
return System.Reflection.Assembly.LoadFrom(strAssemblies_Location);
}

then my code to connect SharePoint. It is not working and throwing the below error,

Error: 0x1 at Script Task 1: Could not load file or assembly 'PnP.Framework, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Task failed: Script Task 1

Any help on this issue, Please?

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,543 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,449 questions
C#
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.
10,180 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Olaf Helper 40,576 Reputation points
    2021-06-15T13:53:42.307+00:00

    Using customer/non-GAC assemblies is in SSIS very limited, the assemblies must be located in SSIS dedicated folder, see
    Referencing Other Assemblies in Scripting Solutions

    0 comments No comments

  2. MichaelHan-MSFT 18,016 Reputation points
    2021-06-16T02:14:05.983+00:00

    Hi @Siva Mani ,

    To load an Assembly in a SSIS script task that isn't in the GAC, you could refer to the below articles:

    https://learn.microsoft.com/en-us/archive/blogs/dbrowne/how-to-load-an-assembly-in-a-ssis-script-task-that-isnt-in-the-gac

    https://blog.matrixpost.net/load-an-custom-assembly-in-sql-server-integration-services-ssis-script-task-that-is-not-or-cannot-be-stored-in-the-gac/

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


    If the response is helpful, please click "Accept Answer" and upvote it.