Manage References in a Project - Visual Studio (Windows) (2023)

  • Article
  • 7 minutes to read

Applies to: Manage References in a Project - Visual Studio (Windows) (1)eyes studioManage References in a Project - Visual Studio (Windows) (2)Visual Studio for MacManage References in a Project - Visual Studio (Windows) (3)visual studio code

Before writing code in an external component or connected service, your project must first contain a reference to it. A reference is essentially an entry in a project file that contains the information Visual Studio needs to find the component or service.

How you add a reference depends on the type of project for the code you're working on:

  • if you see onedependenciesit's mesolution explorer, you can use the right-click context menu to chooseAdd Project Reference. You can also right-click the project node and selectAdd>reference project.

    Manage References in a Project - Visual Studio (Windows) (4)

  • if you see oneReferencesit's mesolution explorer, you can use the right-click context menu to chooseadd reference. Or, right-click the project node and selectAdd>Reference.

    Manage References in a Project - Visual Studio (Windows) (5)

    For more information, seeHow to: Add or Remove References.

    (Video) 62. (C# Basics Beginner Tutorial) Adding Projects and References

You can add a reference to the following types of components and services:

  • Bibliotecas or .NET class assemblies

  • UWP apps

  • AS components

  • Other project assemblies or class libraries in the same solution

  • shared projects

  • xml web services

UWP App References

project references

Universal Windows Platform (UWP) projects can create references to other UWP projects in the solution, or to Windows 8.1 projects or binaries, as long as those projects don't use deprecated APIs in Windows 10 and later. For more information, seeMoving from Windows Runtime 8 to UWP.

If you choose to redirect projects from Windows 8.1 to Windows 10 and later, seeAdapt, migrate, and update Visual Studio projects.

Extension SDK References

Universal Windows Platform (UWP) Visual Basic, C#, C++, and JavaScript apps can reference extension SDKs that target Windows 8.1, as long as those extension SDKs don't use deprecated APIs in Windows 10 and later. Check the extension SDK provider's website to find out if UWP apps can reference it.

(Video) How to Add Reference to your Visual Studio Project

If you determine that the extension SDK your app references is not supported, perform the following steps:

  1. See the name of the project that is causing the error. Your project's target platform is indicated in parentheses next to the project name. For example,My project name (Windows 8.1)means that your projectMyProjectNametargets the Windows 8.1 platform version.

  2. Go to the unsupported extension SDK owner vendor website and install the extension SDK version with dependencies compatible with the target platform version of your project.


    One way to find out if an Extension SDK has dependencies on other Extension SDKs is to look forreferral manager. Restart Visual Studio, create a new C# UWP App project, then right-click the project and chooseadd reference. go to thewindowsguide, then theextensionssub-tab and select Extension SDK. Look at the right panel on thereferral manager. If it has dependencies, they will be listed there.


    If your project specifically targets Windows 10 and the extension SDK installed in the previous step depends on the Microsoft Visual C++ Runtime Package, the Windows 10 compatible Microsoft Visual C++ Runtime Package version is v14 .0 and is installed with Visual Studio .

  3. If the Extension SDK you installed in the previous step has dependencies on other Extension SDKs, go to the websites of the vendors that have the dependencies and install the versions of those dependencies that are compatible with the version of the platform you are connecting to. your project.

    (Video) How to add a reference to the System.Windows.Forms lib from a .NET Core WPF project

  4. Restart Visual Studio and open your app.

  5. Right click on theReferencesodependenciesnode in the project that caused the error and chooseadd reference.

  6. click nowindowsguide and then theextensionssub-tab, clear the checkboxes for the old extension SDKs and select the checkboxes for the new extension SDKs. give a clickOK.

Add a design-time reference

When you reference an assembly in your project, Visual Studio looks for the assembly in the following locations:

  • The current project directory. (You can find these sets using theTo browseeyelash.)

  • Other project directories in the same solution. (You can find these sets onProjectseyelash.)


  • All projects contain an implicit reference tomscorlib.
  • All projects contain an implicit reference toSistema.Núcleo, even ifSistema.Núcleoit is removed from the reference list.
  • Visual Basic projects contain an implicit reference toMicrosoft.VisualBasic.

At runtime, components must be in the project's output path or in the global assembly cache (GAC). If your project contains a reference to an object that is not in one of these locations, you must copy the reference to the project's output path when building the project. Himcopy localThe property indicates whether this copy should be made. if the value isTRUTH, the reference is copied to the project directory when you build the project. if the value isFalse, the reference is not copied.

If you deploy an application that contains a reference to a custom component registered in the GAC, the component will not deploy with the application, regardless of thecopy localenvironment. In previous versions of Visual Studio, you could set thecopy localproperty on a reference to ensure the assembly is implemented. Now you need to manually add the assembly to the \Bin folder. This puts all custom code under scrutiny, which reduces the risk of publishing custom code that you're not familiar with.

(Video) How to add reference in visual studio 2022 | How to add reference in visual studio

By default, thecopy localproperty is defined asFalsewhether the assembly or component is in the global assembly cache or is a framework component. Otherwise, the value is set toTRUTH. Project-to-project references are always defined asTRUTH.

Referencing a project or assembly that targets a different version of .NET

You can create applications that reference projects or assemblies that target a different version of .NET. For example, you can create an application that targets the .NET Framework 4.6, which references an assembly that targets the .NET Framework 4.5. If you create a project that targets an older version of .NET, you cannot set a reference in that project to a project or assembly that targets a newer version.

For more information, seeFrame orientation overview.

Project-by-project references

Project-to-project references are references to projects that contain assemblies; you add project references using theProjectstab of the Reference Manager dialog box. Visual Studio can locate an assembly when given a path to the project.

When you have a project that produces an assembly, you must reference the project and not use a file reference (see below). The advantage of a project-to-project reference is that it creates a dependency between projects in the build system. The dependent project will be created if it has changed since the last time the reference project was created. A file reference does not create a build dependency, so it is possible to build the referenced project without building the dependent project, and the reference can become obsolete. (That is, the project can reference a previously created version of the project.) This can result in the need for multiple versions of a single DLL in thecompartmentdirectory, which is not possible. When this conflict occurs, you will see a message like "Warning: The dependency 'file' in project 'project' cannot be copied to the run directory because it would overwrite the reference 'file'." For more information, seeTroubleshoot broken referencesyHow to: Create and Remove Project Dependencies.


A file reference is created instead of a project-to-project reference if one project's target version of the .NET Framework is version 4.5 and the target version of the other project is version 2, 3, 3.5, or 4.0.

Unlike most other types of projects, ashared projectit has no binary output. Instead, the code is compiled into each project that references it.Shared Projectsthey allow you to write common code that is referenced by many different application projects. Code is compiled as part of each reference project and may include compiler directives to help incorporate platform-specific functionality into the shared code base. Add a reference to a shared project inShared Projectstab of the Reference Manager dialog box.

file references

File references are direct references to assemblies outside the context of a Visual Studio project. You create them using theTo browsetab of the Reference Manager dialog box. Use a file reference when you only output an assembly or component and not the project that creates it.

(Video) C# 18: Understanding Namespaces and Adding References to Assembly in Visual Studio

See too

  • Troubleshoot broken references
  • How to: Add or Remove References


How do I add references to a project in Visual Studio? ›

You can also right-click the project node and select Add > Project Reference. If you see a References node in Solution Explorer, you can use the right-click context menu to choose Add Reference. Or, right-click the project node and select Add > Reference.

Where are Visual Studio project references stored? ›

SOLUTION. When you add your first test to a new test project in Visual Studio, references to the required assemblies are automatically referenced. By default, Visual Studio references assemblies stored in the GAC (Global Assembly Cache) with their specific version number.

How do I remove a reference from a Visual Studio project? ›

  1. Right click on a project name or dependencies node in Solution Explorer.
  2. Select Remove Unused References.
  3. The Remove Unused References dialog will open displaying references that have no usage in source code. ...
  4. Click Apply to remove selected references.
Apr 29, 2022

How to add references in C# project? ›

Add a reference
  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. ...
  2. Select a reference to add, and then select OK.
Sep 30, 2022

How do you list references in a project? ›

Citing your information source by acknowledging a book, journal and author is very important. And that is what a good reference covers.
The elements to be cited include;
  1. Author's name, initials.
  2. Year of Publication.
  3. Title of the article.
  4. Journal.
  5. Volume and part number in bracket.
  6. Page number of contributions.
Jan 26, 2022

How do I see all references in Visual Studio? ›

Your first step is to click on the class name (and click on it in any place you find it, by the way). Then press Shift-F12 or right-click on it and pick Find All References. That opens a References window showing the statements that refer to your object (that window typically opens below your editor window).

How do I replace all references in Visual Studio? ›

You can find and replace text in the Visual Studio editor by using Find and Replace (Ctrl+F or Ctrl+H) or Find/Replace in Files (Ctrl+Shift+F or Ctrl+Shift+H).

How do I enable reference codes in Visual Studio? ›

Step 1: From Settings – Type CodeLens and Enable the Editor: Code Lens and JavaScript > References Code Lens to check the references in JavaScript File.

Where are references stored? ›

A reference is stored on heap.

Where are references to objects stored? ›

New objects are always created in heap space, and the references to these objects are stored in stack memory.

Where are VBA references stored? ›

The VBA reference list (figure 1) can be accessed by the VBE menu Tools > References sequence. The Available References list displays each reference item by its description property, in priority order. References are also part of the libraries drop-down in the Object Browser (figure 2).

How do you remove references? ›

Highlight the citation in your Word document that you would like to delete. A window will pop-up with a listing of the citations you have entered into your manuscript so far. The citation you highlighted will be highlighted blue. Select the Edit Reference tab next to your citation and choose Remove Citation.

How do you remove referencing? ›

This is in the "Citations & Bibliography" sections of the References tab. Click on the source from the "Current List" on the right. This is a list of all added citations, even if they have been deleted from the document text. Click the Delete button in the middle.

What is the shortcut to remove unused references in Visual Studio? ›

I always use the combination CTRL + R, CTRL + G. This sorts the usings and removes the unused ones.

Where are C# references stored? ›

So where do C# variables get stored?
  • Local variables (i.e. those that are declared inside methods) are stored on the stack. ...
  • Objects of reference type variables (i.e. the things that references point to) always live on the heap.
Jul 8, 2022

How do you add reference sources? ›

On the References tab, click Insert Citation. In the Create Source dialog box, next to Type of Source, select the type of source you want to use (for example, a book section or a website). Enter the details for the source and click OK. The source is added as a citation at the place you selected in your document.

How do you organize references? ›

Reference list entries should be alphabetized by the last name of the first author of each work. For multiple articles by the same author, or authors listed in the same order, list the entries in chronological order, from earliest to most recent.

How do you list a list reference? ›

In your text before the list, introduce the source with a signal phrase. Make the list single-spaced. If you change or add words, [do so in brackets]. Then include a citation after the last list item; if the list ends with a period, place your citation after that period.

How do I find DLL references in Visual Studio? ›

Referencing DLLs
  1. In the Solution Explorer pane, right-click your project, then click Add Reference.
  2. In the Add Reference window, click the Browse tab.
  3. In the drop-down list, find the folder for FileNet. ...
  4. Select the DLL file.
  5. Click OK.

How do you find a word in whole project in Visual Studio code? ›

VS Code allows you to quickly search over all files in the currently opened folder. Press Ctrl+Shift+F and enter your search term.

How do I find and replace all occurrences in all files in Visual Studio? ›

On the Edit menu, expand Find and Replace. Choose Replace in Files. If the Find and Replace window is already open, on the toolbar, choose Replace in Files.

How do I add a reference library in VS Code? ›

VSCode works fine with maven or gradle.
the answer is pretty simple:
  1. add the jar to a folder you prefer, e.g. a new directory "lib" in the project folder.
  2. add a line like: <classpathentry kind="lib" path="lib/javaxt-cor. jar"/> to your . classpath .
  3. done. You can simply import it as you are used to.
May 8, 2018

How do I get source control code in Visual Studio? ›

Video outline
  1. Open Folder. File > Open Folder (Ctrl+K Ctrl+O)
  2. Source Control. View > Source Control (SCM) (Ctrl+Shift+G)
  3. Initialize repository. main is the default branch.
  4. Open the Command Palette. View > Command Palette (Ctrl+Shift+P)
  5. Rename a branch. ...
  6. File version control status. ...
  7. Commit file. ...
  8. Create a branch.

How do I add a reference in Visual Studio 2010? ›

Complete the following steps to add an assembly reference in Microsoft Visual Studio.
  1. Select the project in the Solution Explorer.
  2. Select Project»Add Reference to launch the Add Reference dialog box.
  3. (Visual Studio 2010 and earlier) Click the . ...
  4. Click OK to close the Add Reference dialog box.

How do I access references? ›

Open the database. Press ALT+F11 to start Visual Basic Editor. On the Tools menu, click References. Under Available References, click to select the check box next to the name of the library, and then click OK.

How do I find my references? ›

Google Scholar
  1. Go to Google Scholar Advanced Search to display all the search options.
  2. Use the exact phrase search box for the title of the reference.
  3. For where my words occur select in the title of the article.
  4. Use the return articles authored by search box for the author's last name.
  5. Search to locate the reference.

Are references stored in memory? ›

A reference refers to the object or is bound to the object. You can consider it an alias of the variable name. The variable name doesn't use any memory either. It doesn't need to be stored in memory.

What is the difference between object and reference? ›

In short, object is an instance of a class and reference (variable) points out to the object created in the heap area.

How do you use reference objects? ›

Objects of reference are used with individuals who find it difficult to understand spoken words, signs, symbols or photographs. The object can be: A real object, for example a toilet roll to represent going to the toilet. Part of a real object, for example part of a towel to represent bath time.

On which part of memory are the reference types stored? ›

A reference type variable contains a reference to data stored in memory, also known as the heap. The heap is most often used for data that has a longer life. You can have more than one variable point to the same referenced data. Objects are an example of a reference type.

How do I access VBA reference library? ›

From the Tools menu, choose References to display the References dialog box. The References dialog box shows all object libraries registered with the operating system. Scroll through the list for the application whose object library you want to reference.

How do I access references in VBA? ›

Press ALT+F11 to open the Visual Basic Editor. In the Visual Basic Editor window, click References on the Tools menu. In the References dialog box, you can see the references that are selected.

How do I fix missing references in VBA? ›

Press ALT+F11 to open the Visual Basic Editor. On the Tools menu, click References. Click to clear the check box for the type library or object library marked as MISSING: <referencename>.

Can references be moved? ›

Moving to or from an object does not invalidate references or pointers to the object. The address of both objects remains the same.

How do I get rid of reference source not found? ›

Bookmark Not Defined.” or “Error! Reference source not found.” when you update a field that has a broken link to a bookmark. You can restore the original text by pressing Ctrl+Z immediately after receiving the error message. You can press Ctrl+Shift+F9 to convert the text in the field to regular text.

How many references is too many references? ›

Using too many references does not leave much room for your personal standpoint to shine through. As a general rule, you should aim to use one to three, to support each key point you make. This of course depends on subject matter and the point you are discussing, but acts as a good general guide.

What should you not do when referencing? ›

  1. Ignore the different rules for referencing different kinds of work – for example, you need different information for books, journal articles and web pages.
  2. Leave referencing to the last minute: keep a note of things you need to reference along the way.
  3. Leave out any sources you have used.

How do you remove references from a table? ›

To remove a table reference from an SQL statement in the SQL Query Builder:
  1. Right-click the table reference in the Tables pane, and then click Remove Table on the pop-up menu.
  2. Click the table reference in the Tables pane, and then press Delete.

Is there such a thing as too much referencing? ›

Do not worry about using referencing too often. As a general rule, it is better to use the references too often than not enough. This does not refer to the number of different authors/texts, but the frequency of citing those authors. It should be high-frequency overall.

How do I delete a data source in Visual Studio? ›

In Solution Explorer, expand the Data Sources folder. Right-click the data source, and then click Delete. The Delete Objects dialog box appears, showing the objects that will be invalidated if you delete the data source. Review this list carefully before clicking OK to delete the data source.

Where the .NET components will remove unused references? ›

NET components can be used to remove unused references from the managed heap?
  • Freeing memory on the stack.
  • Avoiding memory leaks.
  • Freeing memory occupied by unreferenced objects.
  • Closing unclosed database collections.
  • Closing unclosed files.

What does Ctrl w do in Visual Studio? ›

Edit: popular shortcuts
CommandsKeyboard shortcuts [Special contexts]
Select allCtrl+A
Select current wordCtrl+W [Text Editor]
Selection cancelEsc [Text Editor, Report Designer, Settings Designer, Windows Forms Designer, Managed Resources Editor]
Surround withCtrl+K, Ctrl+S (available only in Visual Studio 2019 and earlier)
42 more rows

How do I add a reference in Visual Studio C++? ›

Using Visual C++ .

In Solution Explorer, select the project. On the Project menu, click Add References. In Visual C++, click References on the Project menu, and then click Add New Reference. In the Add References dialog box, click the tab that corresponds with the category that you want to add a reference to.

How do I add a reference DLL in Visual Studio? ›

Referencing DLLs
  1. In the Solution Explorer pane, right-click your project, then click Add Reference.
  2. In the Add Reference window, click the Browse tab.
  3. In the drop-down list, find the folder for FileNet. ...
  4. Select the DLL file.
  5. Click OK.

How do I add an existing service reference in Visual Studio? ›

In Solution Explorer, right-click the name of the project to which you want to add the service, and then click Add Service Reference. The Add Service Reference dialog box appears. In the Address box, enter the URL for the service, and then click Go to search for the service.

How do you add references to code? ›

When writing a report and citing within the text, the following method (based on common IEEE and ACM citiation rules for other types of references) can be used: <author(s) names> (<date>) <title of program/source code> (<code version>) [<type>].

Where are references stored in C++? ›

A reference is stored on stack. A reference is stored in a queue.


1. How To WORK With MULTIPLE PROJECTS In Visual Studio
(Luiz Parente)
2. Practical C# - Project References
(Andrea Angella)
3. Find References in Visual Studio | Microsoft Dynamics 365 F&O | Nowledge
4. 13 Visual Studio 2022 Tips & Tricks
(Claudio Bernasconi)
5. .Net Referencing Assemblies in Visual Studio
(siyad hams)
6. How to reference DLLs AT RUNTIME outside of your project
(Dev Parkour)


Top Articles
Latest Posts
Article information

Author: Carmelo Roob

Last Updated: 09/12/2023

Views: 5953

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Carmelo Roob

Birthday: 1995-01-09

Address: Apt. 915 481 Sipes Cliff, New Gonzalobury, CO 80176

Phone: +6773780339780

Job: Sales Executive

Hobby: Gaming, Jogging, Rugby, Video gaming, Handball, Ice skating, Web surfing

Introduction: My name is Carmelo Roob, I am a modern, handsome, delightful, comfortable, attractive, vast, good person who loves writing and wants to share my knowledge and understanding with you.