Udostępnij za pośrednictwem


Add Reference Dialog Box

The Add Reference dialog box displays tabbed panes that list the various types of components and projects you can browse. To view the Add Reference dialog box, when a project is selected, click Add Reference on the Project menu, or right-click the Reference node in Solution Explorer and click Add Reference. In the Add Reference dialog box, select the tab for the type of component you wish to browse.

Note

The number of tabs available at the top of the Add Reference dialog box can vary, depending on the type of project open and the resources it is using. Also some components in the list may be disabled and display in grey depending on the .NET Framework version of your project. This is because some components from a more recent .NET Framework version are not compatible with projects based on an earlier .NET Framework version.

Changing the Add Reference dialog box edits the project references file for the selected project. A project references file contains information about the run-time requirements of an application or component, such as which files are needed, how they are to be registered, and where on the user's machine they should be installed. The Add Reference dialog box also adds the object hierarchies for the selected projects to the browsing scope in Class View and the Object Browser.

Security noteSecurity Note:

When incorporating components that require full-trust permissions to run, be aware that code-access security violations could occur. During development, a project runs at full-trust, but the environment the project is deployed to might be partial-trust. At run time, if the environment is partial-trust, you can get code-access security violations. Thus, it is necessary to test applications in a variety of diverse 'trust' scenarios.

The following tabs and controls are available:

  • .NET Tab
    Lists all .NET Framework components available for referencing.

    Component

    Description

    Component Name

    Either the full or "friendly" name of the component.

    Version

    The version number of the component.

    Runtime

    The version number of the .NET Framework that the component was created with.

    Path

    The folder path and filename of the component.

  • COM Tab
    Lists all COM components available for referencing.

    Note

    This tab does not appear during development of Smart Device projects.

    Component

    Description

    Component Name

    Either the full or "friendly" name of the component.

    TypeLib Version

    The version number of the component.

    Path

    The folder path and filename of the component.

  • Projects Tab
    Lists Visual Studio projects in the current solution available for referencing. Select assemblies from this tab to create project-to-project references.

    Component

    Description

    Project Name

    Displays the names of referenced projects.

    Project Directory

    Displays the folder path for referenced projects.

  • Browse Tab
    Allows you browse additional files to find a component not listed in the current tab and add it to the list.

  • Recent Tab
    Displays recently added references.

    Component

    Description

    Component Name

    Either the full or "friendly" name of the component.

    Type

    The component type listed.

    Version

    The version number of the component.

    Source

    The file name of the component and the path to the folder where it is located.

Displaying an Assembly in the Add Reference Dialog Box

The Add Reference dialog box does not automatically display every assembly, even if an assembly has been installed to the Global Assembly Cache (GAC). The Add Reference dialog box is path-based, and there are several methods to display an assembly:

  • Move or copy the assembly to the current project directory (you can find these assemblies using the Browse tab), other project directories within the same solution (you can find these assemblies using the Projects tab), or the Public Assemblies folder at Program Files\Microsoft Visual Studio .NET\Common7\IDE\Public Assemblies; (you can find these assemblies on the .NET tab).

  • Set a reference path to the directory containing the assembly using the Reference Paths Dialog Box (Visual Basic) or the Reference Paths Page, Project Designer (C#).

  • Set a registry key that specifies the location of assemblies to display.

For detailed procedures on how to display an assembly in the Add Reference dialog box, see How to: Add or Remove References in Visual Studio (Visual Basic).

References List Depends On .NET Framework Target

The reference components displayed in the Add Reference dialog box is tied to the version of the .NET Framework used in the project. Components that are not applicable to the project's .NET Framework target display in grey in the list and cannot be added as a reference to the project.

See Also

Tasks

How to: Add or Remove References in Visual Studio (Visual Basic)

How to: Add and Remove References in Visual Studio (C#)

How to: View and Alter the Browsing Scope

How to: Navigate in the Object Browser

How to: Search for Objects, Definitions, and References (Symbols)

Concepts

Build Configurations

Projects as Containers

Item Management in Projects

Reference

Choose Toolbox Items Dialog Box (Visual Studio)

Browsing Code and Components

Change History

Date

History

Reason

July 2009

Noted that project must be selected for entry to appear on Project menu

Customer feedback.