Test Explorer (VS) shows '<Unknown project>'
C#Visual StudioNunitC# Problem Overview
Everthing below is made in VS2019, using .NET Framework 4.7 and NUnit + NUnit3TestAdapter
I created an assembly called Exitus.Tests, and added a few unit tests. However, do to some issues with Nuget, that I could not solve, I made another project called Exitus.UnitTests and removed the once file I had in the old project (including changing the namespace).
Now the new test project showed op correctly in the explorer, but a "ghost" of the old project remained:
If I try to run the test, the output window shows the following error:
> System.InvalidOperationException: The following TestContainer was not found 'C:\Users\xxx\Source\Repositories\Expire\Exitus.Tests\bin\Debug\Exitus.Tests.dll'
at Microsoft.VisualStudio.TestWindow.Client.TestContainer.TestContainerProvider.
The stack trace is a lot longer, but the curious thing is the second line, stating that it could not find the test container at \Exitus.Tests\bin\Debug\Exitus.Tests.dll
. This is the name of the old test project, which I removed and deleted. I have searched my entire project for the term Exitus.Tests
and it returns no results.
Is there anyway to forcefully remove this 'ghost' project?
C# Solutions
Solution 1 - C#
- Close Visual Studio.
- Delete the
*.testlog
files in: solutionfolder\.vs\solution name\v16\TestStore\number.
Solution 2 - C#
I faced the same issue right now. A cleanup helped. As I had cleanup issues with VS in the last time (some DB-lock prevents a real cleanup to happen), my working cleanup was this way:
- Close VS.
- Git Bash in solution folder:
git clean -xfd
Probably it helps.
Solution 3 - C#
Neither of these solutions worked for me. I was able to get the test explorer working by closing visual studio and deleting the ".vs" folder. Then reopen the solution and let it rebuild it.
Solution 4 - C#
According to the Visual Studio developer community (found by going to the Help menu and selecting Feedback), an update to Visual Studio to version 16.5.5 will resolve the issue. FYI: They released this in February 2020
I can confirm it works (I was on VS 16.4.6)
Solution 5 - C#
Steps as below
-
Close Visual Studio
-
Go to the project folder
-
Find the ".vs" folder. (Make sure you are also checking hidden item)
-
Delete ".vs" folder.
-
Good to go, Open visual studio, build and run project.