Could not load file or assembly for project reference

Viewed 1836

I have two class library projects and one Web API project. Let it be ClassLibrary1, ClassLibrary2, WebApi.
I add link for Web API to both ClassLibrary1 and ClassLibrary2 as a project reference.
In addition, ClassLibrary1 has link to ClassLibrary2 as a project reference.

At the compilation stage, I have no errors, But in runtime, I got the next error:
Could not load file or assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

All Nuget packages have the same versions for these projects.

enter image description here

2 Answers

You can refer to the following steps to check the project.

  1. Please ensure the target framework of the project and the development platform are the same.

  2. Please ensure the reference project comes from:\ClassLibraryx\bin\Debug\ClassLibraryx.dll

  3. If there are no problems with the above two, you could try the following steps:

    (1)Remove project references

    (2)Rename two class library projects and rebuild

    (3)Re-add project references

The problem was resolved when I removed the solution from my local storage and reloaded it from the repository.

Related