Add External DLL With SharePoint WSP To GAC

In this blog, I will explain how you can refer external dll in your SharePoint solution to make it work whenever this dll is not there in the Global Assembly Cache. So, the solution itself must contain the dll. To add dll into your SharePoint solution, given below are the steps.

  1. Reference the dll in the Solution references first.



  2. Now, add the dll into your Solution by selecting external dll. Once you add it, it will appear in the References list. But it will not be added to the package of Solution, we have to manually do that.

  3. Open Package.package file.



  4. Open Advanced tab. Click Add > Add Existing Assembly.



  5. Select dll source path. Now, click OK. Make sure that the "Deployment Target" is GlobalAssemblyCache.

Once you are done with the above steps, verify that WSP is containing that dll.

In my case, I have renamed it from EmbedExternalDLLs.wsp file to EmbedExternalDLLs.cab and extracted it to the folder. In that folder, you will find that added dll.

I have attached my demo solution EmbedExternalDLLs for reference.