共用方式為


ProjectTypeResolutionService Class

An abstract class that provides the Visual Studio implementation of the ITypeResolutionService interface.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Shell.Design.ProjectTypeResolutionService

Namespace:  Microsoft.VisualStudio.Shell.Design
Assembly:  Microsoft.VisualStudio.Shell.Design (in Microsoft.VisualStudio.Shell.Design.dll)

Syntax

'宣告
Public MustInherit Class ProjectTypeResolutionService
public abstract class ProjectTypeResolutionService

The ProjectTypeResolutionService type exposes the following members.

Constructors

  Name Description
Protected method ProjectTypeResolutionService When overridden in a derived class, initializes a new instance of the class.

Top

Methods

  Name Description
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType() Gets the Type of the current instance. (Inherited from Object.)
Public method GetType(String, Boolean, Boolean, ReferenceType) When implemented in a derived class, attempts to retrieve a reference type based on search criteria like the name of the type and its case-sensitivity.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

Visual Studio type resolution is based on resolving a project type name to its corresponding Visual Studio references. These references can take on several forms:

Kind of Reference

Description

Files On Disk

These are simple disk-based references that may not break the way that GAC-based references work. This means that a reference to something in the GAC must be loaded from the GAC, not from the SDK directory.

References to a Project

Requires the location of the project output file. Type resolution must also monitor Visual Studio events like renaming a project output file and switching configurations. In the event of a configuration switch the built project will output to a different directory.

Generated Outputs

Tools can generate code directly into the project. This code becomes part of the project, but it can be demand compiled by the project so its binary is accessible without building the entire project. These generated outputs must be searched first, because the types within them always conflict with the current project. Type resolution must also be aware of Visual Studio events like 'rebuild generated outputs' because these are not built automatically.

Each loaded assembly is backed by an AssemblyEntry object, and these objects are factored into groups as described above. Both Files On Disk and References to a Project are pointers to the same objects. Two parallel lists are implemented because References to a Project are always loaded in-memory and this process degrades performance. The retrieval scheme first traverses the Files On Disk list because many of the dlls it references can be loaded via the GAC, which is more efficient from a performance standpoint. If retrieval fails for the Files On Disk list the lookup next transverses the more expensive References to a Project list.

Loading Generated Outputs requires compilation from Visual Studio which makes them the most expensive type to retrieve. Though the performance cost of evaluating these items for a match represents a big performance hit, Generated Outputs still must be checked before References to a Project because Generated Outputs, a special subset of References to a Project, allow duplicate types.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Shell.Design Namespace