为什么我的 C++大会签署?

发布于 2024-12-07 04:54:15 字数 486 浏览 0 评论 0原文

我有一个 C++ 项目,设置为 /clr,它由同一解决方案中的 C# 项目引用。不幸的是,C++ 似乎没有得到正确的签名,导致错误消息“程序集没有强名称”。 (sn.exe 同意该错误。)
但是,项目设置(链接器/高级)中有一个 snk 文件,因此应该对其进行签名。此外,所有项目设置似乎与同一解决方案中的另一个 C++ 项目相同 - 一切正常。

在为此撕扯了我的头发几个小时后,我发现了一件事:
当消除链接器的/NOLOGO开关时,很明显链接器被调用两次。我完全不知道为什么会这样。
现在,在有效的项目中,链接器在命令行 (/KEYFILE:) 中为两个调用传递了 snk 文件,而在则没有的项目中工作,第二次调用没有让 snk 文件通过。

为什么链接器会被调用两次?是什么决定了它没有获取第二次调用中传递的 snk 文件?

I have a C++ project, set to /clr, which is referenced by C# projects in the same solution. Unfortunately, it seems the C++ doesn't get properly signed, leading to the error message "assembly doesn't have a strong name." (sn.exe agrees with that error.)
However, there is an snk file in the project settings (Linker/Advanced), so it should be signed. Further, all project settings seem to be the same as in another C++ project in the same solution - where everything works.

The one thing I have found after tearing my hair over this for hours:
When eliminating the /NOLOGO switch for the linker, it becomes apparent that the linker is called twice. I don't have the slightest idea why that might be.
Now, in the project that works the linker gets passed the snk file in the command line (/KEYFILE:) for both invocations, in the one that does not work, the second invocation does not get the snk file passed.

Why would the linker be invoked twice? What determines that it doesn't get the snk file passed in the second invocation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寒尘 2024-12-14 04:54:15

好吧,我找到了解决方案:显然,MS 搞砸了 VS2010 的 SP1 版本,你必须去 MSBUild 安装文件夹中乱搞。 这里是一篇提供肮脏细节的文章。

(以及为什么这在一个项目中有效,但在另一个项目中不起作用,我不知道。而且,坦率地说,我已经浪费了足够的时间来撞墙,并且不会调查任何更远。)

Ok, I found the solution: Apparently, MS blew the SP1 release for VS2010 and you have to go and mess around in the MSBUild installation folder. Here is an article giving the dirty details.

(And why this would work in one project, but not in the other I have no idea. And, frankly, I've lost enough hours banging my head against this wall already, and will not investigate any further.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文