Multi-Targeting Designer Services
This is the third in my blog series on Visual Studio 2010 Designer Multi-Targeting
Visual Studio 2010 includes a number of services as part of the multi-targeting infrastructure:
These services should be well known to WinForms and WebForms control designers. They allow you to retrieve an assembly or type by name, find types that extend a certain base type, and add a project reference for an assembly.
These services were available in previous versions of Visual Studio, but have been updated in .NET 4 with multi-targeting support. Any types that don’t exist in the project’s target framework will be filtered out. Also, when you add a reference to a framework assembly it will ensure that it references the version from the target framework.
NOTE: Be aware that although these services are filtering the types, they are still returning runtime types. Reflection against these types will not filter the members or metadata.
This is a new service added in .NET 4 which allows you to create a TypeDescriptionProvider which reflects against the target framework. This provides access to the same reflection that the PropertyGrid uses for its filtering. This service is available for WinForms and WebForms projects at design time and will be discussed more in upcoming blog posts.
This service is implemented by the designer’s project system to tell the multi-targeting infrastructure where it should load target and runtime assemblies from. This allows each project system to dictate how it does shadow copying, how it resolves runtime assemblies, and lets it resolve any additional designer assemblies that it needs.
NOTE: Control designers do not need to use this service directly.
These services provide the basic assembly resolution logic for the multi-targeting infrastructure.
IVsFrameworkMultiTargeting is specific to framework assemblies. It allows you to inspect which frameworks are available, which assemblies they contain, which framework a specific assembly belongs to, and where the reference assemblies live.
IVsDesignTimeAssemblyResolution is specific to a project system such as WinForms or WebForms. It can resolve project references and any assemblies in the project’s target framework.
NOTE: Most control designers will not need to use this service directly.