Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Test Explorer (VS) shows '<Unknown project>'

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:

Visual Studio test explorer

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.d__46.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.TestWindow.Controller.TestContainerConfigurationQueryByTestsBase.d__6.MoveNext() (...)

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?

like image 613
Jakob Busk Sørensen Avatar asked Dec 18 '19 12:12

Jakob Busk Sørensen


People also ask

What is test Explorer?

Test Explorer lets you group your tests into a hierarchy. The default hierarchy grouping is Project, Namespace, and then Class. To change the way that tests are organized, choose the Group By button. and select a new grouping criteria.

How do I test a project in Visual Studio?

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.


3 Answers

  1. Close Visual Studio.
  2. Delete the *.testlog files in: solutionfolder\.vs\solution name\v16\TestStore\number.
like image 133
Peter Wretmo Avatar answered Oct 20 '22 10:10

Peter Wretmo


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:

  1. Close VS.
  2. Git Bash in solution folder: git clean -xfd

Probably it helps.

like image 20
Alex B. Avatar answered Oct 20 '22 08:10

Alex B.


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.

like image 44
N-ate Avatar answered Oct 20 '22 10:10

N-ate