Search code examples
c#.netassembliesmefsigning

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


I have an application that uses MEF to dynamically load assemblies. 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.

Can this be done? If so, how?

Thanks


Solution

  • Yes. Implement a filtering catalog that checks if the public key of the assembly is the one that you specify. )