Problem
I’m attempting to compile my excel addin using C# 4.0, however I’m encountering this issue when attempting to create my project in Visual Studio. It’s critical to note that this is the first time I’ve encountered this issue. What could be the reason behind this?
Asked by Sergey Kucher
Solution #1
When I first encountered this issue, I resolved it by disabling the ‘Enable ClickOnce security settings.’
Project | ‘Project name’ Properties… | Security tab | ‘Enable ClickOnce security settings’ check box (Menu: Project | ‘Project name’ Properties… | Security tab | ‘Enable ClickOnce security settings’ check box (Menu: Project |
Answered by CharleZ
Solution #2
I’m guessing you’re not working with assemblies with long names. When two projects refer to slightly different versions of the same assembly, and a more dependent project refers to these projects, I get this error. In my situation, the solution was to remove the key and version information from the assembly name in the.csproj files (it didn’t matter anyway), and then rebuild from scratch.
The sections of the solution that referred to the different assembly versions were compatible with the changes between them. If this is not the case for you, you may need to do some further effort to remedy the problem.
It’s easy to get into this position with NuGet if:
As a result, your solution has two projects that refer to distinct versions of the package’s assemblies. You’ll notice this issue if one of them refers to the other and is a ClickOnce app.
To resolve this, use the update-package [package name] command in the Nuget Package Manager Console to bring everything back up to par, at which point the problem will be resolved.
Unless there’s a compelling reason not to, you should manage NuGet packages at the solution level rather than the project level. Multiple versions of dependencies can be avoided by managing packages at the solution level. If the Consolidated tab in the administration UI displays that one or more packages have various versions, consider merging them into one.
Answered by Kit
Solution #3
See this answer.
Answered by Otiel
Solution #4
This is a problem I’ve had in the past. It happened because I had multiple projects pointing to the same assembly from various versions. I solved issue by applying the same version to all of my projects.
Answered by daniel
Solution #5
You may have previously compiled files referencing the wrong version if you modified your assembly version or copied a different version of the managed library mentioned in the error. A ‘Rebuild All’ (or deleting your ‘bin’ and ‘obj’ directories, as recommended in a previous remark) should solve the problem.
Answered by Sogger
Post is based on https://stackoverflow.com/questions/5133516/why-am-i-getting-assembly-dll-must-be-strong-signed-in-order-to-be-marked-a