Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: A strongly-named assembly is required

Tags:

c#

.net

I have a Windows forms project (VS 2005, .net 2.0). The solution has references to 9 projects. Everything works and compiles fine on one of my computers. When I move it to a second computer, 8 out of the 9 project compile with no problem. When I try to compile the 9th project (the main project for the application - produces the .exe file to execute the application), I get the following error:

'Error 3: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)' 

The file location for the error is is listed as "C:\PATH-TO-APP\LC".

I have checked in the project properties and all of the projects are set to build in Debug mode, none of them are supposed to be signed. In the project that is failing, the only assembly that it references that is not in any of the other projects is Microsoft.VisualBasic (a .net 2.0 assembly). So I am at a loss to find what ids causing this error (the file referenced above in the error message - "LC" - does not exist.

Anyone know how I can force the project to accept all unsigned assemblies, or to determine which assembly is the culprit?

The only meaningful difference between the dev environments between the dev environment where this worked and the current one is that the first was XP and this is Vista64. However, a colleague of mine who is using XP is getting the same error.

Third-party assemblies being used:

  • ComponentFactory.Krypton.Toolkit
  • ComponentFactory.Krypton.Navigator
  • VistaDB.NET20

All of these are referenced in other projects in the solution which build with no problems, so it doesn't look like these are the problem.

So far I have tried deleting the suo file, Rebuild All, unloading and reloading projects from the solution, removing and readding referenced assemblies. Nothing has worked.

like image 497
Yaakov Ellis Avatar asked Nov 14 '08 18:11

Yaakov Ellis


People also ask

Why a strongly named assembly is required?

What the error means. "Strong Name : Indicates that the reference has been signed with a key pair." If your current project's assembly is signed, then all your reference assemblies must also be signed. Failure to do so will result in this error.

How do I get a strong assembly name?

A strong named assembly is generated by using the private key that corresponds to the public key distributed with the assembly, and the assembly itself. The assembly includes the assembly manifest, which contains the names and hashes of all the files that make up the assembly.

How do you tell if an assembly is strongly named?

To determine if an assembly is strong-typed, use the Strong Name Tool from Microsoft (http://msdn.microsoft.com/en-us/library/k5b5tt23(v=vs.71).aspx) by running the 'sn.exe -v <assembly>' command. You may need to download one of the Windows SDK packages to get access to this tool.


2 Answers

What the error means

"Strong Name : Indicates that the reference has been signed with a key pair."

If your current project's assembly is signed, then all your reference assemblies must also be signed. Failure to do so will result in this error.


How to check

Solution Explorer > References > [Click on the reference in question] > Properties

Strong Name = TRUE


How to fix

Method 1 : Unsign your current project's assembly.

Project Properties > Signing > Sign the assembly (checkbox)

enter image description here

Method 2 : Sign the assembly of the reference project. (If you're building it yourself)

Located in Project properties

like image 80
user160357 Avatar answered Sep 23 '22 00:09

user160357


Yet another possible cause:

(for desperate troubleshooters)

In Solution Explorer window, if you walk down your references list and check each in Properties window, seeing property Strong Name = False points to potential problem.

like image 33
miroxlav Avatar answered Sep 21 '22 00:09

miroxlav