asp.net 3.5 referencing project with assembly reference throws signing/strong name error in Unit Test

2

I have a reference to a MySQL.Data 5.2.3 assembly in a data layer, great. I currently I have small console app inteh same solution referencing JUST THIS data layer which connects just fine. I then created a unit test project (also in the same solution) and reference that same data layer project, and from that I get:

Test method LTTests.WrapperTest.LoginTest threw exception: System.IO.FileLoadException: Could not load file or assembly 'MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' 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).

So I'm trying to understand...I can do this for a console exe and it works but not a unit test? This makes me nervous to build on something apparently flawed, but I'm at a loss for what to do next. I'm lost, I've been re-adding various things looking for what the deal is and I have no clue.

The exception is from the data layer and not from the test (per the stack) so it's like the test is calling the layer's method (duh) and the data layer is puking but not for the console?

Thanks.

c#
.net
reference
.net-assembly
asked on Stack Overflow Jan 31, 2011 by bryan • edited Jan 31, 2011 by bryan

1 Answer

1

This is not the answer why there is an error but a possible way to find it out:

You can use the "Assembly Binding Log Viewer" (Fuslogvw.exe) that belongs to the dotnet sdk to find out what is loaded and why.

If logging is enabled it can show you wich assemblies are loaded from which directory and which assembly caused it to load.

For details see http://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.80).aspx

so may be there are different version of MySql.Data lying around and the error message means i.e. that the version number found is not the one it expects.

answered on Stack Overflow Jan 31, 2011 by k3b

User contributions licensed under CC BY-SA 3.0