For those, who have difficulty integrating C# code with SSIS, here are some notes..
How to generate a DLL from a C# class (.cs) file that contains the common methods..
A good reference link to create a .cs file for your methods - MSDN
1. Make sure you have Visual Studio installed for Visual C# - only then the below steps will make sense..
2. Create new project --> File --> New --> Project --> Visual C# --> Class Library project
3. Add the class (.cs) file that you have already created to the project. Right click on the project in the Solution Explorer --> Add --> Existing Item and choose the .cs file.
4. In the menu bar, select "Build--> Build <projectname>"
5. If the build succeeds, check the path --> project path\bin\Debug\ for the
6. Copy this .dll file to the C:\Program Files\Microsoft SQL Server\100\DTS\Binn folder to use it within the SSIS script task.
How to use the DLL file in the script task
1. Inside the script task's project explorer, right click on "References" tab to "Add Reference" to the DLL file.
2. In the .NET tab of the "Add Reference" Dialog box, choose the DLL file that you just created.
If you did not place the DLL file in the \Binn\ folder, you will not see it in this list.
Also, if you did choose the path to the DLL file using the "Browse" or "Recent" tabs in the above dialog box, it will not throw any compilation errors. However, you will face RunTime errors....



No comments:
Post a Comment