macpak
macpak

Reputation: 1301

Custom metadata of .NET assembly

I am creating an architecture where we use a lot of plugins. We'd like to implement sort of "assembly custom metadata", which would tell the plugin host required settings for this assembly. We'd like to "describe" those settings in xml and include that xml description inside the assembly. Is it feasible? I know that I can use a custom assembly attribute, but I am looking for a different solution.

Upvotes: 1

Views: 301

Answers (1)

Anton Gogolev
Anton Gogolev

Reputation: 115691

There are several ways to do that.

  1. You can require plugin authors to embed a resource with a well-defined name, like PluginDescriptor.xml, into the assembly and then Assembly.GetManifestResourceStream() it in your host application
  2. Or you can define an assembly-leve PluginDescriptorAttribute, which would contain the name of the resource to read to get hold of the XML file
  3. Or you can redistribute the file alongside with the DLL (or pack them up into a ZIP file, much like nupkg files are packaged)

Upvotes: 1

Related Questions