You are here
Home > Programming > Visual Studio 2013 Reference Build Error Resolved

Visual Studio 2013 Reference Build Error Resolved

Visual Studio 2013 Reference Build ErrorĀ – I was recently playing around with some code when I switched my solution configuration from Debug to Release. Suddenly, my builds all failed. There was a warning in my Error List that told me that it could not locate one of my references.

The strange thing was that the project built fine in debug mode. The DLL was referenced and the using statements defined. I couldn’t think why my builds would fail in release mode. The solution wasn’t as straightforward as I would have hoped. It seems as though Visual Studio was hinting at the wrong location.

Visual Studio 2013 Reference Build Error Resolved

What do I mean with the previous statement? Well let’s look at the state of my Visual Studio build results.

Visual Studio 2013 Reference Build Error

As you can see from my Error list, Visual Studio was clearly not impressed with the reference to a DLL I had added previously. I need to remind you that this build error only presented itself when I changed from Debug to Release mode.

Visual Studio 2013 Reference Build Error

The second riddle to this whole thing was that the DLL was referenced for my project. I also checked the properties for this DLL and all seemed fine.

Visual Studio 2013 Reference Build Error

When I looked at my using statements at the top of my code file, I could see that the using for my referenced DLL was underlined by the IDE. Something was really wrong with the project.

Visual Studio 2013 Reference Build Error

After a while, I decided to have a look at my csproj file. I did a search for the DLL name and I found a surprising result. In the csproj file, there is a reference to my DLL and a HintPath. When I traced this path, I noticed that the path was wrong. The path was going up 3 levels and then accessing my Dropbox folder.

Visual Studio 2013 Reference Build Error

I then corrected the HintPath by modifying the csproj file in a text editor (SciTE being my favourite) and saved the csproj file. I then reloaded my Visual Studio solution and rebuilt my project. This time, it compiled without any errors.

The error was most likely caused when I moved my Visual Studio project by copying the project to another location. This absolute path reference in the csproj file then caused Visual Studio to fail when trying to find the referenced DLL. I hope that this quick tip can help someone facing a similar problem.

Image

Dirk Strauss
Dirk is a Software Developer from South Africa. He loves all things Technology and is slightly addicted to Jimi Hendrix. Apart from writing code, he also enjoys authoring books and articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has almost mastered.
https://dirkstrauss.com

Similar Articles

Top