C# dll not updating across projects

0 votes
asked Oct 3, 2009 by manobes

I've got a C# project in visual studio that is building a DLL, and another console project which includes the first as a reference. These are both in the same solution.

The trouble is when I add methods to the DLL, then rebuild the console project doesn't seem to pick them up.

For example, in the DLL I have a class Converters. If I add a method

public static void test() {}

it just doesnt' show up in the console app at all. Intellisense doesn't autocomplete it, and if I manually type it in it gives a compiler error.

If I go in and delete the dll files then rebuild that works (or better yet, delete the bin and obj directories) but that seems rather drastic.

I'm sure this is a basic error, but I can't seem to find the solution after some googling.

9 Answers

0 votes
answered Oct 3, 2009 by tom-anderson

Change the reference to the dll to the Project, instead of the output.

0 votes
answered Oct 3, 2009 by steven-robbins

How are you adding the reference? As a project reference or by browsing to the DLL? If you're using the latter then it will copy it locally to the bin directory of your console app and won't refresh it unless you manually delete it. If you add it as a project reference it will copy it as and when it needs to.

0 votes
answered Oct 3, 2009 by jaredpar

This is certainly unexpected behavior. It sounds like the reference between the two projects is broken in some way. Two issues come to mind.

  • Possible problem with the reference. Try deleting the reference in solution explorer and readding the reference and seeing if that fixes things. When you re-add make sure it's a project reference and not a file reference.
  • It's possible that the time stamps on the files in your project are off. See if they are in the future.
0 votes
answered Oct 3, 2009 by kobi

The exact thing happened to me once on a project - it turned out the build command wasn't configured to build these DLLs.
Check Build - Configuration Manager, and make sure the project is checked:

Configuration Manager Screenshot
(Image from msdb - Setting the Build Configuration)

0 votes
answered Oct 29, 2013 by marmont

check the folder which contains the reference. does it contain a refresh file with a relative path in it? if so, and if assembly names in the location pointed to by the relative path are common with those in of (project) references which should auto update, then these references no longer auto update! what you end up is a static reference to the assemblies present in the relative path contained in the refresh file. you may also have to delete the projectreferences key in the sln file and add references afresh

0 votes
answered Oct 19, 2015 by wanttodo

close Project visualStudio and rebuild again your dll (other project visualStudio)

0 votes
answered Oct 28, 2015 by dan

Check that you don't have the ddl inside the bin folder of your project. Whilst I was adding the reference by browsing for the dll, I had forgotten that I manually copy pasted a version into that folder. No matter how many times I cleaned and rebuilt, it didn't seem to update.

Deleting that dll and re-referencing fixed the issue.

0 votes
answered Oct 15, 2016 by himansz

One of the things to note is the Target Framework of the Projects, if you compile your Project A with target framework different then that of Project B and it is referencing the dlls of Project A you may run into this kind of trouble. So, make sure that the target framework for both Projects is same.

0 votes
answered Sep 15, 2017 by rafiki

I hate to beat a dead SO question but 8 years after the original question and none of the above solving the issue for me, my problem was in VS2013, but to solve it I simply removed and re-added the reference to the DLL in the project that invokes it.

I hope this helps some people in the newer VS realm having the same issue.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter