How do I add libraries to my vb.net project?

  • Thread starter HONOREDANCESTOR
  • Start date
H

HONOREDANCESTOR

I have several questions about vb.net projects:

1. When I compile my project, it produces a 'bin' folder and an 'obj'
folder and within the 'obj' folder are 2 other folders - 'debug' and
'release'. If I want my code to access a dll that a third party
produced, where do I put that dll. In 'bin'?, In 'debug'? In 'obj'?

2. I find that when I compile my project into an exe, that I have
several copies of that exe in different places. One was in 'bin', one
was in 'debug' and one was in 'release'. Why would I have three of
them?

3. If I want my code to access a third party dll, does that mean I
should have a 'add references' to that dll? Or is just adding the dll
to the 'bin' directory sufficient?

4. I made a 'solution' which had 2 projects in it - one was source for
a dll of my own, and one was source for a exe that calls the dll. I
thought that I needed 'add references' to make the caller know about
the dll. But 'add references' brings up a screen with several tabs.
The dll project was listed in one of the tabs, but that was not
enough. The caller program did not recognize code statements that
referred to the class in the dll. So I used another tab (of add-
references) where I browsed for the 'bin' directory of the dll
project, and once I did that, the caller exe worked with it. But is
that really what I should be doing?

5. Is there a book out there that addresses issues like these?

Thanks,
HA
 
M

Mark S. Milley, MCSD (BinarySwitch)

Hi -

1. When I compile my project, it produces a 'bin' folder and an 'obj'
folder and within the 'obj' folder are 2 other folders - 'debug' and
'release'. If I want my code to access a dll that a third party
produced, where do I put that dll. In 'bin'?, In 'debug'? In 'obj'?

Neither. Add a reference to the DLL by browsing to it. VS2005 will do
the rest.
2. I find that when I compile my project into an exe, that I have
several copies of that exe in different places. One was in 'bin', one
was in 'debug' and one was in 'release'. Why would I have three of
them?

The debug and release folders are named based on the configuration
name. Without getting too complicated, depending on which
configuration your using when you compile the application, the
resultant exe file resides in the respective folder. (Note: you can
create additional configurations, in which case, the respective folder
would be created, but that's outside the scope of this post.)
3. If I want my code to access a third party dll, does that mean I
should have a 'add references' to that dll? Or is just adding the dll
to the 'bin' directory sufficient?

See 1.
4. I made a 'solution' which had 2 projects in it - one was source for
a dll of my own, and one was source for a exe that calls the dll. I
thought that I needed 'add references' to make the caller know about
the dll. But 'add references' brings up a screen with several tabs.
The dll project was listed in one of the tabs, but that was not
enough. The caller program did not recognize code statements that
referred to the class in the dll. So I used another tab (of add-
references) where I browsed for the 'bin' directory of the dll
project, and once I did that, the caller exe worked with it. But is
that really what I should be doing?

On the application project, you would add a project reference (Add a
Reference, you'll see the class library project in the project tab).
Every time you compile the app, it will compile the dll library, then
your application. (Note: this is also configurable)
5. Is there a book out there that addresses issues like these?

There are a TON of books, and since I'm not being paid to endorse any
of them, I'd recommend that you start with MSDN, since it is a free
resource. Straight from the horses mouth, as it were.

Cheers,

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top