If you’ve created or installed a toolbox item, but it doesn’t appear in the toolbox when the appropriate designer is active, the first thing to do is select “Show All” from the toolbox and check to see if the item is there at all. (The new search feature might help.) If the item is missing altogether, that’s a topic for another blog post, but I’ll briefly suggest you start by looking in the activity log (run “devenv /log” to generate it). If the item is present but disabled, there are a few reasons why this may happen:
1. There is no designer active, or the toolbox wasn’t notified of designer activation for some reason. (This notification should happen automatically without any explicit action from the designer itself.)
2. The designer doesn’t implement IVsToolboxUser. (This interface is needed in order for the toolbox to determine which items should be enabled for this designer.)
3. The item is tagged with a “mimimum required framework version” value that is greater than the project’s framework version. For example, the item might require version 4.0 of the .NET Framework, but the project is targeting version 3.5. (This value is deprecated in VS 2010 in favor of more descriptive metadata (see the following three bullet points), but is still supported for compatibility.)
4. The item’s list of supported target frameworks does not include the project’s target framework or any lower-version framework of the same ID.
5. The item’s assembly and/or type cannot be found in the profile targeted by the project (if the project’s target framework does include a profile).
6. The item is hidden because there is another item representing the same type from a higher-version assembly which is also compatible with the current designer and project.
7. The designer’s IVsToolboxUser::IsSupported method indicated that the control is not supported.
To help determine which of these is the case, create a DWORD registry value called “ShowDiagnosticToolboxTooltips”, set to 1, under HKCU\SOFTWARE\Microsoft\VisualStudio\10.0. Restart VS, open the project and designer, turn on “Show All” if it isn’t already on, and hover the mouse over the unexpectedly disabled item. The tooltip should include some text explaining why the item is disabled:
In this example, the creator of the item only indicated it was compatible with .NETFramework v4.0, but the active designer’s project is targeting v3.5, so the item is disabled. A similar message could be displayed if the item was compatible with the project, but there was a higher-assembly-version item with the same type name; that’s what the portion about “best fit (among all items with the same typename)” means.
This requires VS 2010 Beta2.