How are Metadata Assemblies Found?

How are Metadata Assemblies Found?

Rate This
  • Comments 7

[Update: please see: http://blogs.msdn.com/jnak/archive/2007/10/24/bug-in-finding-metadata-assemblies.aspx about a bug we have in this area] 

Adding on to my last post about adding metadata to Cider and Blend's MetadataStore by using Metadata Assemblies I thought it would be good to talk about how those Metadata Assemblies are found.

If you have a control library assembly that is named MyControls.dll and it is not loaded from the GAC, the first place Cider will look for MyControls.Design.dll and then consequently MyControls.VisualStudio.Design.dll is in the same location that MyControls.dll is loaded.  This is a little tricky because many of us, myself included sometimes forgot to change the build output directory of the Metadata Assembly (i.e. MyControls.Design.dll) to be the location where MyControls.dll is loaded.

The next location we will look, which typically will be the same location above is the location where MyControls.dll is referenced.  For example, if you have a test application that uses the controls in MyControls.dll, it will need to add a reference to MyControls.dll and the corresponding Metadata Assembly will be loaded from that location as well.  One situation where the location of MyControls.dll will be different from MyControls.Design.dll is when is loaded from the GAC.  References aren't ever made to files in the GAC, so we look at the location of the reference to find the location to search for Metadata Assemblies.

Finallly, when MyControls.dll is loaded from the GAC, another location we will look is in the SDK folders which are defined by the entries in:

  • HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders

You can add additional directories to search for by adding a key whose default value is the path you want to add to the above registry key.

This is typically where 3rd Party Control Vendors will add an entry to point to the install location of their controls.  This also puts the assemblies in the .Net tab of the Add References dialog and adds controls in the assemblies found in the AssemblyFolders to the list of items in the Choose Toolbox Items dialog.

Because we didn't want to have the .Net Tab of the Add References dialog or the Choose ToolBox Items Dialog to become overly cluttered with Metadata Assemblies, we also search a "Design" subfolder.  This is the recommended location for your Metadata Assemblies when using the SDK folders.

Leave a Comment
  • Please add 3 and 5 and type the answer here:
  • Post
Page 1 of 1 (7 items)