views:

114

answers:

4

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.

A: 

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

Tom Anderson
+3  A: 

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.

Steven Robbins
Must have been the latter. Changing to project reference seems to have fixed the problem. Many thanks.
manobes
A: 

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.
JaredPar
A: 
Kobi