Solved

c#: What is teh right way to adda new .dll as reference ?

Posted on 2008-06-26
3
236 Views
Last Modified: 2013-12-16
Hi,

I'm working on this CMS (a website) in C# that has several .dll files in the Bin directory.

I've coded a .dll myself, but although I get no errors, it's not working. I suppose it might be because I'm not adding my .dll as a new reference in the proper way.

What I did is to compile it as a new project, copy the resulting .dll to the site's Bin directory and then in VS 2008 right-click on the root directory of the site and chose "Add Reference...".
In the dialog box, it's not in ".NET", "COM" or "Projects". So, I chose "Browse", point to the site's "Bin" directory and select it.

So, my question is: is this the right way to do it ? Something is missing ?
I had another previous version, that i simply deleted. I found no option in VS 2008 to remove the reference whatsoever.

Is this an issue ?

On another note, the "Build solution", only gives me the .dll in the debug directory, I got no "Bin" directory with the .dll
How do I do this ?

Any help would be appreciated.

Warm Regards,
Mário Gamito
0
Comment
Question by:angelsofgrace2006
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Babycorn-Starfish earned 500 total points
ID: 21873932
Hi,
 
after you've added the dll to your project, can you browse the dll? Go to View->Object Browser or View->Other Windows->Object Browser this should provide a tree view of all namspaces you have in your project, the one you have added should be listed if it has been successfully added.
0
 

Author Comment

by:angelsofgrace2006
ID: 21874092
Hi,

No, I haven't it there.
So, how to add it as a reference in the right way ?

Warm Regards,
Mário Gamito
0
 
LVL 11

Expert Comment

by:Babycorn-Starfish
ID: 21877765
Okay,

I do it like this (assuming its a .Net dll, although there's no real difference just different tabs)

1) Right mouse click on References in the Solution Explorer pane in Visual Studio, you'll see a context menu appear with the options Add Reference.... and Add Web Reference.... choose the first option

2) A form will be displayed with tabs .Net, COM, Projects, Browse, Recent, click on the Browse tab

3) The form will shift to the Browse tab and from here you can navigate to where the dll is that you want to add using the familiar 'explorer' interface, find your dll then click okay.

4) The form will close and you'll be back to your IDE, if it's not already expanded click on the + symbol next to references and you'll see a list of all of the references in your solution, System, System.Data etc, you should see the dll that you added.

5) Thats it really, if you're referencing code within the dll then you'll need to add the usual using statements to the top of your code.

Any more probs post back here, good luck
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question