I have an application using MEF to load extensions, and I'd like to be able to retrieve the (assembly) version information before MEF actually loads the extension. I believe this could be done if the assembly information was embedded in the extension's metadata. Unfortunately, it seems the metadata only accepts design time constant values. Maybe someone can tell me otherwise?
Ideally, I'd like to be able to declare the metadata similar to this:
[Export(typeof(IExtension))]
[ExportMetadata("Description", "Spell Checker")]
[ExportMetadata("AssemblyVersionInformation", "???????")]
public class MyExtension : IExtension
{
...
}
Where my metadata interface is defined as:
public interface IExtensionMetadata
{
string Description { get; }
string AssemblyVersionInformation { get; }
}
I've got no idea on what do do about the "???????" in the first part.
I acknowledge my question is very similar to: How do I get the version number of each DLL that has my MEF plugins? But I want to be able to access this information before the plugin is loaded.