我在Visual Studio 2005项目中添加了一个弱命名的程序集(它是强命名的)。我现在得到的错误:

"引用程序集'xxxxxxxx'没有强名称"

我需要签署这个第三方程序集吗?


当前回答

I had this issue for an app that was strongly named then had to change it in order to reference a non-strongly named assembly, so I unchecked 'Sign the assembly' in the project properties Signing section but it still complained. I figured it had to be an artifact somewhere causing the problem since I did everything else correctly and it was just that. I found and removed the line: [assembly: AssemblyKeyFile("yourkeyfilename.snk")] from its assemblyInfo.cs file. Then no build complaints after that.

其他回答

如果您的程序集也是无符号的,则可以使用无符号程序集。

对我来说,问题在于没有强名称的NuGet包。解决方案是从NuGet安装StrongNamer,它会自动向所有引用的程序集添加强名称。只是简单地在项目中引用它修正了我的问题。

我正在寻找解决同样问题的解决方案,取消“签署程序集”选项对我有用:

(正如你可能注意到的,截图来自Visual Studio 2010,但希望它能帮助到一些人。)

我添加了NuGet包“StrongNamer”,我的问题解决了。

情境: 你有方案A B C D在方案X Y中

X中的A、B、C项目 项目A, C, D在Y

我需要在项目A中使用项目C,但后来我不用了。在bin Debug项目A中有C.dll。

如果我编译解决方案X,一切都很好(在这个解决方案中,我删除参考A -> c),但在解决方案Y中,我得到了这个问题。

解决方案是删除项目A中的C.dll bin Debug