Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not resolve this reference. Could not locate the assembly

Tags:

c#

.net

Everytime I build my solution, I get this error message:

Warning

3

Could not resolve this reference. Could not locate the assembly "StandardClassLibrary, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

StandardClassLibrary

So my application has a number of projects of which StandardClassLibrary is one. The above message is a warning and as far as I can tell it does NOT have an impact on my solution.

But I would rather it not be there, just in case...

like image 736
arame3333 Avatar asked Jan 10 '13 15:01

arame3333


People also ask

Can not load file or assembly?

In summary if you get the "Could not load file or assembly error", this means that either your projects or their references were built with a reference to a specific version of an assembly which is missing from your bin directory or GAC.


2 Answers

You most likely get this message when the project points to an old location of the assembly where it no longer exists. Since you were able to build it once, the assembly has already been copied into your bin\Debug / bin\Release folders so your project can still find a copy.

If you open the references node of the project in your solution explorer, there should be a yellow icon next to the reference. Remove the reference and add it again from the correct location.

If you want to know the location it was referenced from, you'd have to open the .csproj file in a text editor and look for the HintPath for that assembly - the IDE for some reason does not show this information.

like image 90
C.Evenhuis Avatar answered Oct 05 '22 11:10

C.Evenhuis


If anyone face this issue with some nuget packages, you can fix that by reinstalling the packages using the Package Manager Console:

Update-Package -reinstall  
like image 40
Martin Brandl Avatar answered Oct 05 '22 11:10

Martin Brandl