Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting 'Assembly '*.dll' must be strong signed in order to be marked as a prerequisite.'?

I'm trying to compile my excel addin using C# 4.0, and started to get this problem when building my project in Visual Studio. It's important to tell you that I haven't had this problem before. What could cause this to happen?

like image 946
Sergey Kucher Avatar asked Feb 27 '11 13:02

Sergey Kucher


People also ask

How do you check if an assembly is signed?

To detect whether the assembly file is signed or not, right click on the file and click the 'Properties' from the context menu. If you see a 'Digital Signatures' tab in the properties window, that means, the file is signed by a digital signature (as shown below).

What is an assembly DLL?

An assembly is a collection of one or more files and one of them DLL or EXE. DLL contains library code to be used by any program running on Windows. A DLL may contain either structured or object oriented libraries. A DLL file can have a nearly infinite possible entry points.


2 Answers

When I had this problem I fixed it by turning off the 'Enable ClickOnce security settings'.

Menu: Project | 'Project name' Properties... | Security tab | 'Enable ClickOnce security settings' check box.

like image 162
CharleZ Avatar answered Sep 18 '22 09:09

CharleZ


My guess is that you're not working with strongly named assemblies. I've had this error when two projects reference slightly different versions of the same assembly and a more dependent project references these projects. The resolution in my case was to remove the key and version information from the assembly name in the .csproj files (it didn't matter anyway), and then do a clean build.

Changes between the different assembly versions were compatible with the parts of the solution referring to them. If this is not the case with you, you might have to do some more work to resolve the issue.

NuGet

With NuGet it's easy to get into this situation if:

  1. You install a package to one project in your solution.
  2. A new version of that package is deployed to the package source.
  3. You install it to another project in the same solution.

This results in two projects in your solution referencing different versions of that package's assemblies. If one of them references the other and is a ClickOnce app, you'll see this problem.

To fix this, issue the update-package [package name] command at the Nuget Package Manager Console to bring everything up to a level playing field, at which point the problem goes away.

You should manage NuGet packages at the solution level rather than at the project level unless there is a compelling reason not to. Solution level package management avoids the potential of multiple versions of dependencies. When using the management UI, if the Consolidated tab shows 1 or more packages have multiple versions, consider consolidating them to one.

like image 26
Kit Avatar answered Sep 20 '22 09:09

Kit