Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my project reference point to a dll in the "obj" directory?

I'm adding a project reference to a project, that already has a few project references added to it. If I inspect the existing ones' properties, they all have paths to their projects' bin directory, e.g.:

C:\MyProject2\bin\Debug\MyProject2.dll

However, when adding another project reference, it ends up with a path pointing to its obj directory:

C:\MyProject3\obj\Debug\MyProject3.dll

That dll doesn't even seem to exist! (Although that might be because I can't get the entire solution to compile yet.)

Why would one project reference point to the bin, and another to obj? And how to correct it?

like image 504
Protector one Avatar asked Jun 27 '16 10:06

Protector one


People also ask

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 .

How do I change the path of a reference in Visual Studio?

If you're using Visual Basic, select the References page, and then click the Reference Paths button. In the Reference Paths dialog box, type the path of the folder that contains the item you want to reference in the Folder field, and then click the Add Folder button.

How do I reference a DLL in C #?

Copy the downloaded DLL file in a custom folder on your dev drive, then add the reference to your project using the Browse button in the Add Reference dialog. Be sure that the new reference has the Copy Local = True .


2 Answers

When the referenced project isn't built, the reference's path will point to a DLL in the obj directory. After it has been built, the path will automatically point to a (now existing DLL) in the bin directory.

like image 84
Protector one Avatar answered Oct 21 '22 15:10

Protector one


You can correct it easily by editing the project in notepad and changing the path. Alternatively right click the project in the solution choose unload, then edit. Then once changed right click in project and choose reload.

like image 36
Anubis Avatar answered Oct 21 '22 16:10

Anubis