Skip to content

Commit 22ea712

Browse files
authored
Merge pull request #8521 from MicrosoftDocs/main638001759535466766sync_temp
Repo sync for protected CLA branch
2 parents 0e3a9ac + 9449670 commit 22ea712

File tree

4 files changed

+36
-19
lines changed

4 files changed

+36
-19
lines changed

docs/ide/how-to-add-or-remove-references-by-using-the-reference-manager.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Add references in the Reference Manager
33
description: Learn how to use the Reference Manager dialog box to add and manage references to developed components.
44
ms.custom: SEO-VS-2020
5-
ms.date: 08/30/2021
5+
ms.date: 09/30/2022
66
ms.topic: how-to
77
f1_keywords:
88
- VS.ReferenceManager
@@ -29,34 +29,41 @@ ms.workload:
2929

3030
[!INCLUDE [Visual Studio](~/includes/applies-to-version/vs-windows-only.md)]
3131

32-
You can use the Reference Manager dialog box to add and manage references to components that you, Microsoft, or another company developed. If you're developing a Universal Windows app, your project automatically references all of the correct Windows SDK DLLs. If you are developing a .NET application, your project automatically references *mscorlib.dll*. Some .NET APIs are exposed in components that you have to add manually. References to COM components or custom components have to be added manually.
32+
You can use the Reference Manager dialog box to add and manage references to components that you, Microsoft, or another company developed. If you're developing a Universal Windows app, your project automatically references all of the correct Windows SDK DLLs. If you're developing a .NET application, your project automatically references *mscorlib.dll*. Some .NET APIs are exposed in components that you have to add manually. References to COM components or custom components have to be added manually.
3333

3434
## Reference Manager dialog box
3535

3636
The Reference Manager dialog box shows different categories on the left side, depending on the project type:
3737

38-
- **Assemblies**, with **Framework** and **Extensions** subgroups
38+
- **[Assemblies](#assemblies-tab)**, with **Framework** and **Extensions** subgroups
3939

40-
- **COM** lists all COM components that are available for referencing
40+
- **[COM](#com-tab)** lists all COM components that are available for referencing
4141

42-
- **Projects**
42+
- **[Projects](#projects-tab)**
4343

44-
- **Shared Projects**
44+
- **[Shared Projects](#shared-projects-tab)**
4545

46-
- **Windows**, with **Core** and **Extensions** subgroups. You can explore the references in the Windows SDK or extension SDKs by using the **Object Browser**.
46+
- **[Windows](#universal-windows-tab)**, with **Core** and **Extensions** subgroups. You can explore the references in the Windows SDK or extension SDKs by using the **Object Browser**.
4747

48-
- **Browse**, with **Recent** subgroup
48+
- **[Browse](#browse)**, with **Recent** subgroup
4949

5050
> [!NOTE]
5151
> You might not see **Browse** in the Reference Manager dialog box if you're developing C++ projects.
5252
5353
## Add a reference
5454

55-
1. In **Solution Explorer**, right-click on the **References** or **Dependencies** node and choose either **Add Project Reference**, **Add Shared Project Reference**, or **Add COM Reference**. (You can right-click the project node and select **Add** from the fly-out menu to choose from these options, too.)
55+
1. In **Solution Explorer**, right-click the **References** or **Dependencies** node, and then choose either **Add Project Reference**, **Add Shared Project Reference**, or **Add COM Reference** from the context menu. (You can right-click the project node and select **Add** from the fly-out menu to choose from these options, too.)
56+
57+
:::image type="content" source="media/add-reference-options.png" alt-text="Screenshot of the Add Reference dialog from the context menu in Solution Explorer.":::
5658

5759
**Reference Manager** opens and lists the available references by group.
5860

59-
2. Specify the references to add, and then select **OK**.
61+
:::image type="content" source="media/reference-manager.png" alt-text="Screenshot of the Reference Manager dialog box in Visual Studio.":::
62+
63+
2. Select a reference to add, and then select **OK**.
64+
65+
> [!NOTE]
66+
> If you don't see the reference you're looking for, select **Browse** to locate the reference. (If you're developing C++ projects, you might not see a browse option.)
6067
6168
## Assemblies tab
6269

@@ -68,7 +75,7 @@ All desktop projects contain an implicit reference to **mscorlib**. Visual Basic
6875

6976
If a project type doesn't support assemblies, the tab won't appear in the Reference Manager dialog box.
7077

71-
The **Assemblies** tab consists of two sub-tabs:
78+
The **Assemblies** tab consists of two subtabs:
7279

7380
1. **Framework** lists all assemblies that constitute the targeted framework.
7481

@@ -100,10 +107,10 @@ Some components in the list may not be shown, depending on the framework version
100107

101108
- A component that uses .NET Framework 4 is incompatible with a project that targets the .NET Framework 4.5.
102109

103-
You should avoid adding file references to outputs of another project in the same solution, because doing this may cause compilation errors. Instead, use the **Projects** tab of the **Add Reference** dialog box to create project-to-project references. This makes team development easier by enabling better management of the class libraries you create in your projects. For more information, see [Troubleshoot broken references](../ide/troubleshooting-broken-references.md).
110+
You should avoid adding file references to outputs of another project in the same solution, because doing so might cause compilation errors. Instead, use the **Projects** tab of the **Add Reference** dialog box to create project-to-project references. This makes team development easier by enabling better management of the class libraries you create in your projects. For more information, see [Troubleshoot broken references](../ide/troubleshooting-broken-references.md).
104111

105112
> [!NOTE]
106-
> In Visual Studio 2015 or later, a file reference instead of a project reference is created if the target framework version of one project is .NET Framework 4.5 or later, and the target version of the other project is .NET Framework 2, 3, 3.5, or 4.0.
113+
> In Visual Studio 2015 or later, a file reference instead of a project reference is created if the target framework version of one project is .NET Framework 4.5 or later, and the target version of the other project is .NET Framework 2, 3, 3.5, or 4.0. For more information about .NET, .NET Framework, and .NET Core, see [What is .NET (and .NET Core)](/dotnet/core/introduction).
107114
108115
### To display an assembly in the Add Reference dialog box
109116

@@ -135,20 +142,20 @@ You should avoid adding file references to outputs of another project in the sam
135142

136143
Creating the registry key under the `HKEY_LOCAL_MACHINE` node allows all users to see the assemblies in the specified location in the **Add Reference** dialog box. Creating the registry key under the `HKEY_CURRENT_USER` node affects only the setting for the current user.
137144

138-
Open the **Add Reference** dialog box again. The assemblies should appear on the **.NET** tab. If they do not, make sure that the assemblies are located in the specified *AssemblyLocation* directory, restart Visual Studio, and try again.
145+
Open the **Add Reference** dialog box again. The assemblies should appear on the **.NET** tab. If they don't, make sure that the assemblies are located in the specified *AssemblyLocation* directory, restart Visual Studio, and try again.
139146

140147
## Projects tab
141148

142-
The **Projects** tab lists all compatible projects within the current solution, in the **Solution** sub-tab.
149+
The **Projects** tab lists all compatible projects within the current solution, in the **Solution** subtab.
143150

144-
A project can reference another project that targets a different framework version. For example, you could create a project that targets the .NET Framework 4 but that references an assembly that's been built for the .NET Framework 2. However, the .NET Framework 2 project can't reference a .NET Framework 4 project. For more information, see [Framework targeting overview](../ide/visual-studio-multi-targeting-overview.md).
151+
A project can reference another project that targets a different framework version. For example, you could create a project that targets the .NET Framework 4 but that references an assembly that's been built for the .NET Framework 2. However, the .NET Framework 2 project can't reference a .NET Framework 4 project. For more information, see [Framework targeting overview](visual-studio-multi-targeting-overview.md).
145152

146153
> [!NOTE]
147154
> A project that targets the .NET Framework 4 is incompatible with a project that targets the .NET Framework 4 Client Profile.
148155
149156
## Shared Projects tab
150157

151-
Add a reference to a shared project on the **Shared Projects** tab of the Reference Manager dialog box. [Shared Projects](/xamarin/cross-platform/app-fundamentals/shared-projects?tabs=windows) let you write common code that's referenced by a number of different application projects.
158+
Add a reference to a shared project on the **Shared Projects** tab of the Reference Manager dialog box. [Shared Projects](/xamarin/cross-platform/app-fundamentals/shared-projects?tabs=windows) let you write common code that's referenced by many different application projects.
152159

153160
## Universal Windows tab
154161

@@ -165,7 +172,7 @@ Universal Windows app projects have a reference to the Universal Windows SDK by
165172

166173
An SDK is a collection of files that Visual Studio treats as a single component. In the **Extensions** tab, SDKs that apply to the project from which the Reference Manager dialog box was invoked are listed as single entries. When added to a project, all of the SDK content is consumed by Visual Studio such that the user doesn't need to take any further actions to leverage the SDK contents in IntelliSense, toolbox, designers, Object Browser, build, deployment, debugging, and packaging.
167174

168-
For information about how to display your SDK in the **Extensions** tab, see [Creating a Software Development Kit](../extensibility/creating-a-software-development-kit.md).
175+
For information about how to display your SDK in the **Extensions** tab, see [Create a Software Development Kit](../extensibility/creating-a-software-development-kit.md).
169176

170177
> [!NOTE]
171178
> If a project references an SDK that depends on another SDK, Visual Studio won't consume the second SDK unless you manually add a reference to the second SDK. When a user chooses an SDK on the **Extensions** tab, the Reference Manager dialog box helps you identify SDK dependencies by listing any dependencies in the details pane.
@@ -211,6 +218,16 @@ When doing a file reference to a WinMD, the expected layout is that the *\<FileN
211218

212219
The search bar in the Reference Manager dialog box operates over the tab that's in focus. For example, if a user types "System" in the search bar while the **Solution** tab is in focus, the search won't return any results unless the solution consists of a project name that contains "System".
213220

221+
## Remove a reference
222+
223+
You can remove unused references for [SDK style projects](/dotnet/core/project-sdk/overview) in Visual Studio by using the **Remove Unused Reference** menu item.
224+
225+
:::image type="content" source="media/remove-unused-reference.png" alt-text="Screenshot of the Remove Unused Reference dialog from the context menu in Solution Explorer.":::
226+
227+
For more information, see [Remove unused references](reference/remove-unused-references.md).
228+
214229
## See also
215230

216-
- [Manage references in a project](../ide/managing-references-in-a-project.md)
231+
- [Manage references in a project](managing-references-in-a-project.md)
232+
- [Troubleshoot broken references](troubleshooting-broken-references.md)
233+
- [NuGet versus SDK as a project reference](../extensibility/nuget-versus-sdk-references.md)
21.4 KB
Loading

docs/ide/media/reference-manager.png

32.8 KB
Loading
82.3 KB
Loading

0 commit comments

Comments
 (0)