0

I have previously referenced an old version of a dll but have now changed it to a newer version. But for some reason it sometimes still copies the old version of the dll when debugging.

If I first clean the solution and then hit debug (F5) it uses the correct version of the dll.

On the other hand if I first clean the solution, then build the solution (CTRL+SHIFT+B) and then hit debug (F5) it uses the old version. The strange thing is that if I just clean the solution and then build the solution, it copies the correct dll. So it is only when cleaning, building and then debugging it uses the old dll.

I have deleted the reference and readded it referencing the new version of the dll, but it still copies the old dll sometimes per the behavior above.

I am using Visual Web Developer 2010 Express.

Any ideas why ?

thanks

Thomas

ThomasD
  • 2,464
  • 6
  • 40
  • 56

1 Answers1

0

I am always running into problems with the references. There are a number of reasons why an old version of the dll could be referened but the easiest solution is to delete the bin + obj folders in the project then recompile. It will then throw errors if your dll's are incorrectly referenced.

You may also want to look into building in release mode or building in debug mode. I believe you may be cleaning the solution and then only rebuilding the project in release mode, leaving the debugged compiled code out of date (clean doesn't always wipe all the data which is why I delete the bin+obj files).

SamuelDavis
  • 3,312
  • 3
  • 17
  • 19
  • 1
    I tried deleting obj-folders and bin-folders and also tried a freetext search for the old dll but without finding anything – ThomasD Sep 10 '12 at 21:05
  • If I select the Release-solution configuration it seems to work. But if I choose the Debug-solution configuration the strange behavior described above happens. Btw I copy the newest dll in the Pre-build event. But the new dll is still overwritten with the old dll – ThomasD Sep 10 '12 at 21:38
  • You are **never** meant to drag and drop stuff into the bin, the same way as you would never want to store permanent information in RAM without saving to the hard drive. The bin is overwritten each time the program is compiled. Reference the original source of the dlls. – SamuelDavis Sep 13 '12 at 19:45
  • At our work we have a CompiledDlls folder where all the programs dlls are automatically sent. We reference those and it sounds like you should employ a similar structure. – SamuelDavis Sep 13 '12 at 19:48