Could not load file or assembly 'DotNetOpenAuth, Version=3.4.8.11250, Culture=neutral, PublicKeyToke

Posted by SheoNarayan under Others on 9/7/2011 | Points: 10 | Views : 7206 | Status : [Administrator] | Replies : 4
I am trying to use DotNetOpenAuth to implement OpenId authentication in one of the website and I am getting following error when I am referring the DotNetOpenAuth .dll in my application and running it.


Error 2 Could not load file or assembly 'DotNetOpenAuth, Version=3.4.8.11250, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)


I tried to create a new strong key and build the project, despite that it is not working.

Any idea?

Regards,
Sheo Narayan
http://www.dotnetfunda.com



Responses

Posted by: Niladri.biswas on: 9/7/2011 [Member] Platinum | Points: 25

Up
0
Down
From the top of my mind,

Which version of dotnet framework u are using and whether DotNetOpenAuth .dll is that dotnet version compatible?

For example if u are using dotnet 4.0 while that dll will support till framework 3.5, then there is a mismatch and u may get this kind of error.



Best Regards,
Niladri Biswas

SheoNarayan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Aarnott on: 9/7/2011 [Member] Starter | Points: 25

Up
0
Down
DotNetOpenAuth runs on .NET 3.5 and later. You can download a pre-signed version of the dll. Why are you building your own?

(The reason I ask: most people who are building their own dotnetopenauth.dll are doing so to make a "small change" that breaks the security model of the protocol inadvertently, and there's always a better way).

SheoNarayan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: SheoNarayan on: 9/7/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
@Niladri - I am using 4.0 Framework and have build the project by targeting to 4.0 framework.

@Aarnott - I downloaded the .zip from http://www.dotnetopenauth.net but that doesn't contain the pre-signed version of the .dll. It has DotNetOpenAuth.BuildTasks.dll not DotNetOpenAuth.dll, so I tried to build it myself.

I tried to read http://bhaidar.net/post/2011/04/04/OpenID-Single-Sign-On-ASPNET-Web-Forms.aspx article as well and downloaded the sample

But as AddRequired method doesn't exists into the FetchRequest object so I have to use Add method but that doesn't accepts Attributes name so following code is throwing error.

var fetchRequest = new DotNetOpenAuth.OpenId.Extensions.AttributeExchange.FetchRequest();

fetchRequest.Attributes.Add(DotNetOpenAuth.OpenId.Extensions.AttributeExchange.WellKnownAttributes.Name.First);

In above code there is no AddRequired method.



Regards,
Sheo Narayan
http://www.dotnetfunda.com

SheoNarayan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Aarnott on: 9/7/2011 [Member] Starter | Points: 25

Up
0
Down
@Sheo, DotNetOpenAuth runs fine on .NET 4.0 without recompiling. You may have inadvertently stumbled upon the source .zip of dotnetopenauth instead of the binary .zip. Please download the zip from http://sourceforge.net/projects/dnoa/files/releases/v3.4/v3.4.7/DotNetOpenAuth-3.4.7.11121.zip/download which should include the fully signed dll.

The AddRequired method is an extension method. You need to add a "using DotNetOpenAuth.OpenId.Extensions.AttributeExchange;" clause to the top of your source file for the AddRequired method to show up.

SheoNarayan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response