RestSharp strong name is not working

3

My application requirement is to use Signed assembly. I signed RestSharp assembly using Visual Studio 2012 command tool. The application builds successfully, but when it runs, the following error appears:

Could not load file or assembly 'RestSharp, Version=104.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Is there any solution to this?

restsharp
strongname
asked on Stack Overflow Mar 25, 2014 by Raja Shahid • edited Mar 25, 2014 by doppelgreener

3 Answers

7

Just a remind, There is signed version of RestSharp(RestSharpSigned) in Nuget.

answered on Stack Overflow Jul 13, 2016 by Liang
2

The blog http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing/ has helped me to solve the problem. Actually I am using twilio.api.dll in my project and twilio.api.dll is referencing RestSharp.dll. Now after making RestSharp as "Strong Name", it was required to enter Public Key token in Twilio assembly so that it can access RestSharp.

The problem has been fixed now.

answered on Stack Overflow Apr 4, 2014 by Raja Shahid
0

There is a way to add strong name to an existing dll. All you need is sn.exe, ildasm.exe and ilasm.exe These are .NET Framework tools designed by Microsoft: https://docs.microsoft.com/en-us/dotnet/framework/tools/ . To run these tools, use the Developer Command Prompt for Visual Studio.

Step 1: You should create a key file using sn.exe:

sn.exe -k C:\IAmWorkingHere\KeyFile1.snk

A KeyFile1.snk was created to C:\IAmWorkingHere folder. We will use it in step 3.

Step 2: Use ildasm.exe to "extract" IL code, resources etc. from the dll.

ildasm.exe /out c:\IAmWorkingHere\RestSharp.il

It is depending on your RestSharp version, but for me 2 file was created a RestSharp.il file that contains the IL Code in text format, and a RestSharp.res file that contains the resource information of the dll.

Step 3 (Rename the original RestSharp.dll if you want to keep it safe) and use ilasm.exe to create your strong named RestSharp.dll

ilasm.exe c:\IAmWorkingHere\RestSharp.il /dll /key=c:\IAmWorkingHere\KeyFile1.snk /resource:c:\IAmWorkingHere\RestSharp.res

And your strong named RestSharp.dll was created.

I hope it is help.

answered on Stack Overflow Oct 25, 2020 by 75ntamas

User contributions licensed under CC BY-SA 3.0