arame3333
arame3333

Reputation: 10193

Could not resolve this reference. Could not locate the assembly

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...

Upvotes: 80

Views: 195289

Answers (13)

G Stoykov
G Stoykov

Reputation: 11

In my case I had the following warnings:

Could not resolve this reference. Could not locate the assembly "x". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.

No way to resolve conflict between "x, Version=1.0.0.248, Culture=neutral, PublicKeyToken=null" and "x". Choosing "x, Version=1.0.0.248

The path to the dll was correct in my .csproj file but I had it referenced twice and the second reference was with another version. Once I deleted the unnecessary reference, the warning disappeared.

Upvotes: 1

Prasanth Raj
Prasanth Raj

Reputation: 167

I had faced similar linker issues while adding a NuGet package into the iOS project (in Xamarin forms project). We had earlier provided the additional mtouch argument in the build configurations like this -dlsym:false -cxx -v -v -v -v -gcc_flags

After removing -dlsym:false from the configuration, the issues got resolved for me.

Upvotes: 0

Vipin Krishna
Vipin Krishna

Reputation: 365

I had this issue after VS mac updation. iOS sdk was updated. I was referring the ios dll in project folder. The version number in the hintpath was changed.

Earlier:

<Reference Include="Xamarin.iOS">   
     <HintPath>..\..\..\..\..\..\..\..\Library\Frameworks\Xamarin.iOS.framework\Versions\13.18.2.1\lib\mono\Xamarin.iOS\Xamarin.iOS.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.iOS">
      <HintPath>..\..\..\..\..\..\..\Library\Frameworks\Xamarin.iOS.framework\Versions\13.18.1.31\lib\mono\Xamarin.iOS\Xamarin.iOS.dll</HintPath>
    </Reference>
    <Reference Include="Xamarin.iOS">          <HintPath>..\..\..\..\..\..\..\Library\Frameworks\Xamarin.iOS.framework\Versions\13.18.3.2\lib\mono\Xamarin.iOS\Xamarin.iOS.dll</HintPath>
    </Reference>

I referred to the numbers in the previous commit and changed only the numbers in project folder, did nothing in android,ios folders. Worked for me!!!

Now:

<Reference Include="Xamarin.iOS">                                                            
 <HintPath>..\..\..\..\..\..\..\..\Library\Frameworks\Xamarin.iOS.framework\Versions\13.20.2.2\lib\mono\Xamarin.iOS\Xamarin.iOS.dll</HintPath>
        </Reference> 

Upvotes: 1

faizan aslam
faizan aslam

Reputation: 17

in my case, it happened because of .net framework version miss match with MySQL connector library. when I updated my .NET version, every thing worked smooth. http://net-informations.com/q/faq/mysql.html#:~:text=Add%20Reference,Library%20in%20your%20C%23%20project.

Upvotes: 0

glihm
glihm

Reputation: 1246

in 2020, this behavior still present with VS2019. (even if I clean projects from the solution explorer in VS2019, this not solves the problem)

The solution that worked for me was to open the folder of the project, and manually remove the \bin and \obj directories.

Upvotes: 3

Jose A
Jose A

Reputation: 11077

If you have built an image with Docker, and you're getting these strange messages:

warning MSB3245: Could not resolve this reference. Could not locate the assembly "Microsoft.Extensions.Configuration.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [/src/Utilities/Utilities.csproj]

Open the affected projectUtilities/Utilities.csproj, (You shall look for your project). You may need to choose Unload Project from the menu first. Right click on the .csproj file and edit it.

Now, delete all the <HintPath> tags

Save, and try again.

enter image description here

enter image description here

Upvotes: 7

Janis
Janis

Reputation: 19

Maybe it will help someone, but sometimes Name tag might be missing for a reference and it leads that assembly cannot be found when building with MSBuild. Make sure that Name tag is available for particular reference csproj file, for example,

    <ProjectReference Include="..\MyDependency1.csproj">
      <Project>{9A2D95B3-63B0-4D53-91F1-5EFB99B22FE8}</Project>
      <Name>MyDependency1</Name>
    </ProjectReference>

Upvotes: 1

Martin Brandl
Martin Brandl

Reputation: 58931

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 

Upvotes: 34

BHoltzman
BHoltzman

Reputation: 11

I had the same warning in VS 2017. As it turned out in my case I had added a unit test project and needed to set a dependency for the unit test on the DLL it was testing.

Upvotes: 1

scsfdev
scsfdev

Reputation: 355

If the project is check out to different PC through team foundation server with different location of same library file, there will be no yellow icon mark in Reference but when change to Release build and build the project, it will give an error. Just like what @C.Evenhuis said, it will use back old one in previous build (eg: Debug build) so I didn't notice the mistake.

Now I know it is a bad habit to put library files in different location on different PC.

Just need to delete the reference and re-add the same reference from correct location.

Upvotes: 2

Alex Strickland
Alex Strickland

Reputation: 1614

This confused me for a while until I worked out that the dependencies of the various projects in the solution had been messed up. Get that straight and naturally your assembly appears in the right place.

Upvotes: 0

user1682406
user1682406

Reputation: 2381

Check if your project files are read-only. Remove the read-only property by right clicking on the project folder and select properties. In the properties screen remove the read-only checkbox. I came across the same problem, and this solved it for me.

Upvotes: 2

C.Evenhuis
C.Evenhuis

Reputation: 26436

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.

Upvotes: 89

Related Questions