SharePoint 2016: A strongly-named assembly is required

In this post, we’ll learn how to sign DLL with a strong name key to an existing DLL file that you don’t have its source code, and you want to use this DLL in SharePoint and ASP.NET solutions without facing this error “A strongly-named assembly is required.

Could not load file or assembly ‘dll, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ or one of its dependencies. A strongly-named assembly is required.


How to Sign DLL with a strong name key to an existing DLL?

Here, we will provide two different ways to sing DLL with a strong name key in case,

  1. You don’t have a source code and you just have the DLL file.
  2. You have the source code for your DLL file.

DLL referenced file not had a Strong Key

If you have tried to build a SharePoint solution that has a reference to an existing DLL file that is not signed with a strong key, you will get the following error DLL referenced file not had a Strong Key. Therefore, in order to set a strong key for a DLL file that you don’t have its source code, you should follow the below steps:

Steps

  1. Open “Visual Studio Command Prompt” from Start Menu.
vs-command-prompt
  1. Drop the DLL file in a local temp folder in drive C:\.
  2. Navigate to your DLL Path file by Typing cd\ to go to the Root C:\
  3. Type cd then Tap Button to navigate to your specific temp folder.
  4. Generate the Key file.
sn -k Skey.snk
  1. Get the MSIL for the assembly.
ildasm Microsoft.ApplicationBlocks.Data.dll /out:Microsoft.ApplicationBlocks.Data.il
  1. Rename the original assembly, just in case.
ren Microsoft.ApplicationBlocks.Data.dll Microsoft.ApplicationBlocks.Data.dll.orig
VSCommand
  1. Build a new assembly from the MSIL output and your KeyFile.
ilasm Microsoft.ApplicationBlocks.Data.il /dll /key=Skey.snk
Sign DLL with a strong name key
Sign DLL with a strong name key

Now, the DLL file should be signed with a strong key and it’s read to use in your Visual Studio.

A strongly-named assembly is required

If you have the source code, and you would like to sing your project with a strongly key name, you should use Signing in Visual Studio as the following:

Steps

  1. Open your Project in Visual Studio as Administrator.
  2. In Solution explorer > Right Click on your Project > Select “Properties”.
SharePoint Project Properties in Visual Studio
  1. Click on “Signing” tab > Check > “Sign this assembly”.
  2. Choose a strong file or create a new one.
sign dll for sharepoint solution - A strongly-named assembly is required

How to add a DLL to a SharePoint Solution in Visual Studio?

After signing your assembly with a strong key, it should be ready now to be added as a reference to your SharePoint and ASP.Net solution by doing the following:

Steps

  1. Copy the Strongly-Key sinning DLL file to the SharePoint Web Application BIN Folder located at \\inetpub\wwwroot\wss\VirtualDirectories\web App Port\bin
    • Open IIS.
    • Expand Sites > Right Click on your SharePoint Site > Select Explore to open the web site folder.
    • Open the BIN folder, and paste the Strongly-Key sinning DLL file.
Explore Web site in IIS Manager
  1. Open your SharePoint solution in Visual Studio.
  2. Right-click on References > Select Add to add a new reference.
add reference in sharepoint visual studio-min

Don’t forget to remove the old reference before adding the new one.

  1. Browse and select Strongly-Key sinning DLL file.
  2. Build and Deploy your solution that should be working properly.
Add reference in Visual Studio

Conclusion

In conclusion, we learned how to Sign DLL with a strong name key that you don’t have its source code to can use it in Visual Studio and avoid such errors A strongly-named assembly is required or DLL referenced file not had a Strong Key.

Applied To
  • SharePoint 2016.
  • SharePoint 2013.
See Also

Leave a Reply

Scroll to Top