Question should i need to run dll for every change

softhard

Active member
Joined
Sep 29, 2012
Messages
35
Programming Experience
Beginner
Hi,
I have dll file which is used by the current program. i have been changing some code inside this dll and thought that this changes should automatically reflect on the current vb.net development program and today i came to know that this is wrong. Is that true? Should í need to run the dll again and should i add this to the current project after then? Is there any information available on this topic some where? please help me.

Thank you.
 
Hi,
I have dll file which is used by the current program. i have been changing some code inside this dll and thought that this changes should automatically reflect on the current vb.net development program and today i came to know that this is wrong. Is that true? Should í need to run the dll again and should i add this to the current project after then? Is there any information available on this topic some where? please help me.

Thank you.
Typically when you reference a dll in your app (other than the Framework's or OS dlls) Visual Studio will copy that dll into your project's bin folder and reference that one. This means that when you make changes to (and compile) the dll you're not actually changing the one your app is using. What you should do is add the dll project to your current solution (right click the solution at the top of the solution explorer and select "add" -> "exiting project"). Keep in mind for all of the projects you do that for, any changes you make to the dll will be reflected in all of the projects next time you build them.

If you don't want the dll project in the same solutions as the projects that use it, what you will need to do is when you get done making changes to the dll project, take the dll and copy it into each of the projects that use it & be sure to test them all too.

Here's a little bit of a discussion on this: Project reference vs. DLL Reference - Which is better?
 
Thanks for information sharing, as you said now i add my dll project to current solution and i changed something in my added dll, though, it is not at all reflect on the current project when i run it. Really, why is it so? Ahhh! then i remvoed the previous dll added into the current project properties. Still, i have not seen any changes when i run my code. I think i need help again!
 
There are three ways to add reference:
  1. the library project is added to solution and you add a project reference in application project. Library project is rebuilt if changed when you rebuild solution, application use new version.
  2. you reference the dll file
    • from the library build output path. When you build the standalone library project the application will pick up the new version.
    • from a local copy of the dll file. You must put the new compiled dll at this path for the application to pick up the new version.
  3. you reference an assembly from GAC. This is typically done for .Net assemblies and larger installed frameworks and common libraries.
For option 2 check the reference Path property to see where it looks for the dll.

For option 2 there is also the properties 'Copy Local' and 'Specific Version' that is used at compile time, these are special cases that probably does not affect the average developer. Copy Local is True by default, which means the dll is copied to application output directory (which it should). 'Specific Version' is False by default, application will use whatever version is present in source Path. If 'Specific Version' is changed to True and application already has a local copy of the referenced version, and source library is compiled to new version (in this case 'version' means assembly version!), then application will not pick up the new version but will use the existing version that was originally referenced.
 
Back
Top