I have Business Intelligence -> Integration Services Project where I have SSIS Packages -> Script Task. I need to call from Script Task Unmanaged code using DllImport. Since I don't know where code for Script Task is stored during run-time I can't call my unmanaged dll.
Example code below for Script Task:
using System; // Console
using System.Runtime.InteropServices; // DllImport
class App
{
[DllImport("lib.dll", CallingConvention = CallingConvention.Cdecl)]
extern static int next(int n);
static void Main()
{
Console.WriteLine(next(0));
Dts.TaskResult = (int)ScriptResults.Success;
}
}
You can find more about Script Task here
Question: How to call Unmanaged Code from SSRS Package -> Script Task?
SSIS won't load dll's by location, even managed dll's. You have to GAC them, http://microsoft-ssis.blogspot.com/2011/05/referencing-custom-assembly-inside.html . I would therefore expect you to have to COM register your unmanaged dll, https://technet.microsoft.com/en-us/library/bb490985.aspx .
Make sure to copy c/c++ dll into " C:\\Program Files\\Microsoft SQL Server\\120\\DTS\\Binn " which will be loaded when managed code calls DllImport
NOTE: 120 is version specific make sure to copy to the correct version that you have.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.