我在Visual Studio 2005项目中添加了一个弱命名的程序集(它是强命名的)。我现在得到的错误:
"引用程序集'xxxxxxxx'没有强名称"
我需要签署这个第三方程序集吗?
我在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包“StrongNamer”,我的问题解决了。
如@Michal Stefanow所说,删除“Signing”选项卡下的“Sign the assembly”复选标记。
Add here是为自己的文件和/或其他人的文件签名的最简单方法。你只需要在“Post-build event命令行”下添加这一行:
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\signtool.exe" sign /f "$(ProjectDir)\YourPfxFileNameHere.pfx" /p YourPfxFilePasswordHere /d "Your software title here" /du http://www.yourWebsiteHere.com /t http://timestamp.verisign.com/scripts/timstamp.dll /v "$(BaseOutputPath)$(TargetFileName)"
你可以给别人的文件签名,也可以给自己的文件签名,想签多少都行。
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.
展开使用“没有强名称键”的项目的项目文件,寻找.snk文件(. strongnamekey)。
在Windows资源管理器中浏览这个文件(这样你就知道它在哪里了)。
回到Visual Studio中那个没有“强名称键”的项目,做
右键单击项目文件 选择属性 选择“签名选项卡”(在左侧) 单击“签署程序集”复选框 然后<Browse>到前面找到的.snk文件
这样应该可以了。这为我解决了一个问题,在同一个解决方案中,在另一个项目中使用一个表单。
我希望这能有所帮助。
如果您的程序集也是无符号的,则可以使用无符号程序集。