Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project Reference Vs File Reference?

References can be added in two ways in a project.

  1. Project Reference.
  2. File Reference.

But, When to use Project and when to use File reference?

like image 809
Dhanapal Avatar asked Jun 10 '09 05:06

Dhanapal


People also ask

What is a project reference?

A reference project is a write-protected copy of a project at a particular time.

What is the difference between project reference and DLL reference?

If you directly add a DLL then you are locked into whatever that particular DLL was built as. The project reference allows this to be a build time decision. This is correct what you are saying. At the same time it is not causing issues when working with .

What is project reference in Visual Studio?

A reference is essentially an entry in a project file that contains the information that Visual Studio needs to locate the component or the service.


1 Answers

You didn't specify but I'm guessing you're referring to Visual Studio?

The main difference between a project reference and a file reference is whether or not live updates are available. In a project reference you will be able to see the effects of edits in one project immediately in the other project via items like Intellisense. So if you for instance add class named Foo, this this type will show up in intellisense immediately in any project which has a project reference on that project.

File references on the other hand can only see changes that are present on disk. A compilation must be performed and bits written to disk in order to see the changes.

In general, it's best to use a project reference.

Another angle that needs to be considered is the relative languages of the projects. Project to Project references are maximally useful if the language in both projects are the same. If the languages are different they tend to be treated more like file references than project references.

like image 53
JaredPar Avatar answered Oct 05 '22 17:10

JaredPar