Avoid Registering DLL using GACutil


  • Working on .Net 3.0.

    We have implemented the script task under SSIS to download and unzip the file and which is running fine on our local environment when we tested.

    On server environment we are getting the issue “Could not load file or assembly 'Interop.Shell32, Version=, Culture=neutral, PublicKeyToken=aad7673e5ba23c29' or one of its dependencies.“

    This issue occurs when SSIS is unable to load the “Interop.Shell32.dll” file, we can resolve this issue by registering the .dll in GAC in my local environment as mentioned in below steps.

    As we don’t have machine access of Server Environment, we are unable to perform those steps.

    Is there any other way to dynamically load the dll?

    Steps to Register DLL

    • Go to Project->st_xxxxx Properties, Signing, tick sign the assembly, select New, type any file name, untick Protect my file with a password.

    • Go to References, Add, COM, select Microsoft Shell Controls And Automation, OK.

      ** You should see a popup saying No template information found..., just ignore that. **

    • Highlight the Microsoft Shell Controls you just added and look at the bottom right properties section, make sure "Strong Name" is True.

      (if you haven't done step 2., this should be False, redo step 2 and make sure this is True)

    • Open My Computer and go to the path of the generated Microsoft Shell Controls dll (see the highlighted Path, usually it is C:\Users\xxxxxxx\AppData\Local\Temp\SSIS\yyyyyyyyyyyyyyyyy\obj\Debug\Interop.Shell32.dll). Copy it to somewhere else (its because the original path yyyyyyyyyyyyyy is randomly generated everytime you edit your script, causing that the signed dll gone everytime).

    • Back to the Project->st_xxxxx Properties, remove the highlighted Microsoft Shell Controls. Click Add, Browse, select the Interop.Shell32.dll you just copied, OK. Again, make sure the Strong Name property is True. If not, redo from step 2.

    • Still at References, under Imported namespaces, scroll down to tick the box next to Shell32.

    • Go to Signing, untick Sign the assembly. Go to Project Explorer on top right, delete the key file (xxxx.snk) you created at step 2 (delete the key file within Project Explorer, not from your folder, make sure it is not included in your Project Explorer anymore or your script task wont run).

    • Save all and close the Script Editing window.

    • Locate "gacutil.exe" in your computer. You should have it together with the installation of SSIS. Its under C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64. Type gacutil -i "path of your copied Interop.Shell32.dll in step 5".

    Friday, November 01, 2013 5:59 AM

All replies