简体   繁体   English

如何将 MEF(托管扩展性框架)配置为仅加载签名程序集

[英]How to configure MEF (Managed Extensibility Framework) to only load signed assemblies

I have an application that uses MEF to dynamically load assemblies.我有一个使用 MEF 动态加载程序集的应用程序。 However, currently, it is loading my assemblies whether they are signed or not.但是,目前,它正在加载我的程序集,无论它们是否已签名。 I want to prevent others from dropping in their own assemblies and having my application load them and run them.我想防止其他人放入他们自己的程序集并让我的应用程序加载它们并运行它们。 I'd like MEF to only load assemblies that have been signed by me.我希望 MEF 仅加载已由我签名的程序集。

Can this be done?这可以做到吗? If so, how?如果是这样,怎么做?

Thanks谢谢

Yes.是的。 Implement a filtering catalog that checks if the public key of the assembly is the one that you specify.实现一个过滤目录来检查程序集的公钥是否是您指定的那个。 ) )

Here's a blog post that shows exactly how to do this: How To Control Who Can Write Extensions For Your MEF Application这是一篇博客文章,它准确地展示了如何做到这一点: 如何控制谁可以为您的 MEF 应用程序编写扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM