When I try to run my Unit Test project, I get the following error:
Could not load file or assembly \'ASSEMBLY_NAME, Version=1.0.0.0, Culture=neutral, Pub
There is a common error about executing unit tests : the execution folder.
Are you sure your unit test is running in the correct folder ? Not in the famous obj folder ?
In the obj folder, only generated assemblies are copied, not dependencies -even copy local true-. So if your test is launched from this folder, all the dependencies will missing.
Another possible cause is if the assembly name of unit test project is using the same name as the assembly under test. (ie make sure your unit test assembly name is unique).
References->Mark dlls->right click->properties->Copy Local set to true
Make sure Dependencies > Edit References > Project (you project) is selected and not .net Assembly of the project
After checking out some additional search results I came across this question here at SA Private Accessor for method is not found .
After I deleted the *.accessor file, my test project stopped complaining and compiled succesfully.
Everybody thanks for their help!
I had this error and I fixed it by UPDATING NUGET PACKAGES.
This worked because one of my projects in the solution was referencing a very old compiled version of another project that was contained in the same solution.
When I used "Run All" tests in Visual Studio, I suppose it copies over the "current" outputs of the projects, and then the nuget package dependency dlls afterwards, which overwrites the originals if they have the same name. (total guesswork there)
When I inspected the error message, I could see that my project was referencing "version 0.0.10" of a dependency, but my solution contained the project all the way up to "version 0.0.30", so massive difference.