I came across an issue this week when loading a DLL to the SSIS integration runtime. Loading MSI packages is quite straightforward however, loading a single DLL proved to be quite a challenge.
According to the documentation https://docs.microsoft.com/en-us/azure/data-factory/how-to-configure-azure-ssis-ir-custom-setup you should provide a blob container in which you put a CMD task called main.cmd, in this you can then run your packages/dll to import them.
What I would like to achieve today is import the DLL for Analysis Services, which is the Microsoft.AnalysisServices.DLL.
We start off by creating a blob container and in this blob container we place the DLL which we need.
Then we will have to create a main.cmd which will load the DLL, we cannot use regsrv32 for this or msiexec, the way to go is using gacutil, which is included in the vs SDK.
The code below is the content for main.cmd, you will need to alter this for your own dll’s
@echo off
xcopy /F /Y Microsoft.AnalysisServices.dll “%ProgramFiles%\Microsoft SQL Server\140\DTS\Tasks” REM error handling if %ERRORLEVEL% neq 0 ( echo Failed with ExitCode %ERRORLEVEL% exit /b %ERRORLEVEL%) echo “Complete copied to x64 folder” xcopy /F /Y Microsoft.AnalysisServices.dll “%ProgramFiles(x86)%\Microsoft SQL Server\140\DTS\Tasks” REM error handling if %ERRORLEVEL% neq 0 ( echo Failed with ExitCode %ERRORLEVEL% exit /b %ERRORLEVEL%) echo “Complete copied to x86 folder” gacutil\gacutil /i Microsoft.AnalysisServices.dll /f REM error handling if %ERRORLEVEL% neq 0 ( echo Failed with ExitCode %ERRORLEVEL% exit /b %ERRORLEVEL%) echo Successfully installed Analysis Services DLL Task. |
One of the first mistakes I made was naming the file Main.CMD, the start of the script is case sensitive so make sure you explicitly write main.cmd
The next issue I had was that I need the folder for gacutil.exe, to get around this I have added the gacutil.exe and all dependent files to the container which will be doing the custom setup.
This is what your container should look like.
In the background, any content you add to the container will be copied to a folder (C:\setup) on the VM’s hosting the SSIS IR, so in the main.cmd you are able to manipulate the environment by moving files around or loading new dll’s.
After these steps, you can use the DLL you loaded into the SSIS IR.