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

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

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


当前回答

展开使用“没有强名称键”的项目的项目文件,寻找.snk文件(. strongnamekey)。

在Windows资源管理器中浏览这个文件(这样你就知道它在哪里了)。

回到Visual Studio中那个没有“强名称键”的项目,做

右键单击项目文件 选择属性 选择“签名选项卡”(在左侧) 单击“签署程序集”复选框 然后<Browse>到前面找到的.snk文件

这样应该可以了。这为我解决了一个问题,在同一个解决方案中,在另一个项目中使用一个表单。

我希望这能有所帮助。

其他回答

为第三方程序集签名对我来说很有效:

引用程序集没有强名称

我了解到,如果链接的文章不再有效,发布步骤是很有帮助的。所有功劳归于Hiren Khirsaria:

运行Visual Studio命令提示符并转到DLL所在的目录。 例如,我的DLL位于D:/hiren/Test.dll 现在使用下面的命令创建CIL文件。 D:/hiren> ildasm /all /out=Test。il Test.dll(此命令生成代码库) 生成一个新密钥来对项目进行签名。 D:/hiren> sn -k mykey.snk 现在使用ilasm命令对库进行签名。 D:/hiren> ilasm /dll /key=mykey。snk Test.il

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

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

对我来说,我的问题是我有两个相同的NuGet包安装了不同的版本。

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.

情境: 你有方案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