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, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified.
The assembly under test is located in the same solution and every project target .NET 4.0 framework. It worked for a while, but today I got this error again. I can't figure out what is wrong, because the error message doesn't tell me enough. (like; WHICH file could not be found..)
I've tried to add a new Test project, but also that one worked for a while before it gave me this same error message.
Is there anybody who can point me in the right direction?
Edit: In the diagnostic build log, the following error appears:
C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\TeamTest\
Microsoft.TeamTest.targets(14,5):
error : Could not load file or assembly 'ASSEMBLY_NAME, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies.
The system cannot find the file specified.
Done executing task "BuildShadowTask" -- FAILED. (TaskId:671)
Done building target "ResolveTestReferences" in
project "ASSEMBLY_NAME.Tests.vbproj" -- FAILED.: (TargetId:985)
Run tests in Test Explorer If Test Explorer is not visible, choose Test on the Visual Studio menu, choose Windows, and then choose Test Explorer (or press Ctrl + E, T). As you run, write, and rerun your tests, the Test Explorer displays the results in a default grouping of Project, Namespace, and Class.
Add a Google Test project in Visual Studio 2022In Solution Explorer, right-click on the solution node and choose Add > New Project. Set Language to C++ and type test in the search box. From the results list, choose Google Test Project. Give the test project a name and choose OK.
Select the test project in Solution Explorer. On the Project menu, select Add Reference. In Reference Manager, select the Solution node under Projects. Select the code project you want to test, and then select OK.
Check Build->Configuration Manager...
menu. All projects should have the same platform and column Build
checked.
Also you can take a look into output of the build (Output
window), it usually states more clearly which file could not be found.
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With