Visual Studio: The referenced component could not be found

I often have the problem that in Visual Studio suddenly the references (referenced libraries) are no longer available. This usually occurs when I have comitted the VS project via git and want to continue working on another computer. This also occurs when, for example, my colleague has continued to work on a project and I then fetch the latest version via git using a pull request. In most cases, the previous cause is that an update has been made for the integrated libraries, such as Telerik, and now the version levels that are stored in the *.cproj file differ with the installed versions.

Error messages

The whole thing then manifests itself in the error message when compiling:

„The referenced component ‚[…]‘ could not be found.“

Screenshot Error List of Visual Studio with error message: The referenced component ... could not be found
error message

And if you look in the Solution Explorer under the project under References, you will see the references in question with a yellow triangle and exclamation mark in the icon.

Screenshot Visual Studio Solution Explorer with yellow triangle and exclamation mark at references
References not found in Solution Explorer

If you take a closer look at the properties of the references, you can see that all affected references have the property “Specific Version” set to True and the property is version 0.0.0.0.

Screenshot Visual Studio Properties window with assembly version 0.0.0.0
Package version is 0.0.0.0 in Visual Studio

So this can’t be. Something cannot be right here. This is annoying and eats up unnecessary time that you would rather spend programming.

Solution 1: Update references

One solution is to update all references. To save time and work I tried it first via the Package Manager Console. And there I inserted the following command:

PM> Update-Package

If the Package Manager Console is not displayed, you can access it via “View” ➤ “Other Views” ➤ “Package Manager Console”.

Screenshot Package Manager Console in Visual Studio
Update Packages with Package Manager Console

Some references were updated and are now available. But unfortunately not all of them. By and large, the problem remains.

As a second attempt I then tried the following command,

PM> Update-Package -Reinstall

which uninstalls the Nuget references and then reinstalls them. Unfortunately, this also did not lead to the desired success. Many references were removed, but not reinstalled.

Solution 2: Set Specific Version to False

Another solution can be to set the property “Specific Version” to False in the properties of the affected refreces.

Screenshot Visual Studio Properties-Window
Set specific version to “False”

For some of the affected references this worked. They lost the yellow triangle with exclamation mark. Unfortunately, this procedure did not work for all references.

Solution 3: Manually uninstall and reinstall packages

If all else fails, the less refreshing and tedious solution is to manually uninstall the individual packages via the NuGet Package Manager and then reinstall them.

If you have already done the Update-Package -Reinstall before, you may only have to reinstall because the packages in question are already uninstalled.

Visual Studio: Found conflicts between different versions of packages
Reinstall component via NuGet Package Manager

You can start the NuGet Package Manager by right-clicking on the project and selecting “Manage NuGet Packages…“. Or you can go to the menu via “Tools ➤ “Nuget Package Manager” ➤ “Manage NuGet Packages for Solution”.

Unfortunately, new unexpected problems can occur when reinstalling the packages. For example, I received an error message of the type:

Found conflicts between different versions of “assembly” that could not be resolved.

Only a downgrade of the conflicting package to a supported version will help.

Leave a Reply

Your email address will not be published. Required fields are marked *