Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSVC Dependencies vs. References

Tags:

c++

visual-c++

I have always used the Visual Studio Dependencies option to ensure that, for example, when building my C++ projects, any dependent LIB or DLL projects are also built. However, I keep hearing people mention 'references' and wondered, with VS 2010 on the horizon, I should be changing how I do this.

Are there any benefits to using references to dependencies or is the former a .NET feature only? I am currently using VS2008.

like image 921
Rob Avatar asked Feb 23 '10 08:02

Rob


People also ask

What is the difference between dependencies and references in Visual Studio?

They are basically no different, they are used to store and manage references. Just as Lex said, the Dependencies is a better way to represent different types of references, we can clearly know where the reference comes from, SDK, nuget, etc. so that we can manage our references more efficiently.

How do you add references to VS code?

Restart Visual Studio and open your app. Right-click on the References or Dependencies node in the project that caused the error and choose Add Reference.

What is a project reference?

A project reference is a link from the current Studio project to another project. The reference makes certain resources in the referenced project become available for use in the current project.


1 Answers

I prefer using references since these were introduced for unmanaged C++ in VS 2005. The difference (in unmanaged C++ developer's perspective) is that reference is stored in .vcproj file, while project dependencies are stored in .sln file.

This difference means that when you reuse your project in different solutions (and I often do) you don't need to redefine the inter-project relationships again.

Visual Studio is smart enough not to depend gravely on the paths of the projects when it establishes the reference relationship.

like image 166
Alex Cohn Avatar answered Oct 23 '22 10:10

Alex Cohn