Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

References not updating properly in Visual Studio

I am working on a rather large project in visual studio, and I have several references to other solutions and projects within my current solution. One of my user controls resides in a separate solution, so I need to consistently be able to update the DLL to fit any changes to my code. The only problem is, Visual Studio will not update my references unless I go through a long, meticulous process which I will try to describe now:

  1. First, I must clean and rebuild the solution that contains the changed code. Here is a snippet of the class I need to update:

    This is a little snippet of the class I need to update

I just added the highlighted property, so my other project does not recognize it yet. I used blank properties like HelloWorld and ISuddenlyDespiseYogurt because they are easy to spot in code and properties will show in the compiled version of the code.

  1. Secondly, I must go to the project I am trying to use the DLL in, delete the reference, and re add it.

enter image description here

I right click on the reference I want, click delete, then right click on the "References" tab, press "Add Reference", then I use the file path of my other solution and update the reference.

  1. Lastly, I must restart Visual Studio and reopen the project I was working on.

enter image description here

And now our new property is recognized by my project. This solution works every time, but it is a ridiculously annoying workaround, and I am hoping someone out there knows how to make this process much easier.

This is the closest thing I can find to a similar problem on StackOverflow, and the rest of the internet is no help. If anyone has any clue how to fix this problem, I would very much appreciate your insight.

like image 439
Cubemaster Avatar asked Oct 18 '25 07:10

Cubemaster


2 Answers

I have a feeling that your project is copying the library .DLL to your project folder, instead of linking over to the Hamilton.HST project's Release folder.

Two things I would check from your side: when you're linking the reference and clicking 'Browse', where exactly are you grabbing the .DLL from? Hopefully the Release folder, or some other output that changes when the Hamilton.HST project is recompiled. And second, check your main project and the properties on the Reference, to make sure it's pointed to that Hamilton.HST folder (like I said, I have a suspicion its pointing to somewhere in your second project's folder, and that VS copied the DLL over instead of linking.)

like image 155
Kevin Avatar answered Oct 19 '25 21:10

Kevin


I managed to fix the problem, hopefully for good. For the sake of anyone else who may have this problem, here is my solution:

I went into the "Properties" tab of my project, by right clicking on the project name in Solution Explorer and clicking "Properties". I then navigated to "Build Events", where I saw something like this:

enter image description here

The first two lines were there when I opened the window, and I added the last line. From what I can gather, the addition of that line tells my program where to look for updated DLL's upon building the project, and I had the wrong location before.

Other than that, I have no idea how this solution worked, but hopefully it can work for someone else. If anyone knows the logic behind this solution, please let me know so I can clarify my answer. Thanks to everyone who gave me suggestions to fix this!

like image 28
Cubemaster Avatar answered Oct 19 '25 20:10

Cubemaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!