C# dll not updating across projects

16,247

Solution 1

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.

Solution 2

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)

Solution 3

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

Solution 4

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.

Solution 5

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.

Share:
16,247
manobes
Author by

manobes

Updated on June 17, 2022

Comments

  • manobes
    manobes almost 2 years

    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.