c# - 你能做一个“弱”吗?对强命名程序集的程序集引用
由于各种原因,我宁愿不在我的项目中使用强命名(签名)程序集。但是,其中一个项目由共享点 Web 部件引用,这意味着必须对其进行签名。
是否可以对该程序集进行签名,但是当我从其他项目引用它时,使用非强引用来执行此操作。这将为我的代码的其余部分提供未签名的程序集的优势,但仍然允许它由共享点加载。
For various reasons i would rather not use strong named (signed) assemblies in my project. however, one of the projects is referenced by a sharepoint web part which means it must be signed.
is it possible to have this assembly signed but when I reference it from other projects, to do so using a non-strong reference. this would give me the advantages of having a non-signed assembly for the rest of my code but still allow it to be loaded by sharepoint.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
最简单的方法可能是使用两种不同的项目配置 - 其中一种构建强命名程序集,另一种则不构建。显然,您需要小心如何构建和引用程序集,但这与存在冲突需求的领域有关。
The simplest way to do this is probably to have two different project configurations - one of which builds a strongly named assembly and one of which doesn't. Obviously you'll need to be careful how you build and reference the assembly, but that goes with the territory of having conflicting requirements.
只需继续构建您的项目,无需使用强名称。当您需要将其部署到Sharepoint时,请在构建后使用工具对其进行签名。这里有一个工具可以做到这一点:
http://signer.codeplex.com/Wikipage
您还可以手动执行,但它是 PITA:
http://buffered.io/posts/net-fu-signing-an-unsigned- assembly-without-delay-signing/
Just keep building your project w/o strong names. When you need to deploy it to Sharepoint, use a tool to sign it after it is built. Here's a tool that does exactly that:
http://signer.codeplex.com/Wikipage
You can also do it manually, but it's a PITA:
http://buffered.io/posts/net-fu-signing-an-unsigned-assembly-without-delay-signing/
这是 OP,但我没有 OpenID 登录,所以我想我无法以我自己的身份回复。
感谢两位的回复。我认为这两种方法都可以,但事实证明情况有点复杂。我在这里记录了我的发现,以防其他人感兴趣。
事实上,sharepoint引用程序集A,而程序集A又引用程序集B。
我可以毫无问题地构建未签名的程序集A和B,但是如果我想签名A,我必须更改项目本身以引用签名版本程序集 B。
尽管可能有办法做到这一点,但我们认为,使用不同的同名 DLL 集可能会导致 DLL 冲突和配置控制问题,因此不值得这么麻烦。
因此,我们决定在所有构建中对这两个程序集进行签名,并在必要时将代码重构到不同的程序集中,以确保签名的程序集中只有最少量的代码,这样它们就不太可能更改。
蒂姆
This is the OP but I don't have an OpenID login so I guess I can't reply as myself.
Thanks for both the responses. I think either would have worked but the situation turned out to be a bit more complex. I've documented my findings here in case anyone else is interested.
In fact sharepoint references assembly A and assembly A in turn references assembly B.
I can build assembly A and B both unsigned with no problem, but then if I want to sign A, I have to change the project itself to reference the signed version of assembly B.
Although there might have been a way to do this, we decided the possible DLL conflicts and configuration control problems with having different sets of DLLs with the same name were not worth the hassle.
So we have decided to sign both these assemblies in all builds, refactoring code into different assemblies where necessary to make sure that only the minimum amount of code is in the signed ones so they are less likely to change.
Tim