Running unit tests with .NET Core MSTest: "The following TestContainer was not found..."

Josh Withee picture Josh Withee · Jul 10, 2018 · Viewed 10.8k times · Source

I've searched high and low and can't find answer to this Exception. This question is the main one to come up when I search, but it doesn't address this issue.

[7/8/2018 6:22:22 PM Informational] Executing test method 'CoreScraper.FlyerScraper.GetAllCurrentFlyers'
[7/8/2018 6:22:22 PM Error] System.InvalidOperationException: The following TestContainer was not found 'C:\Users\Username\Documents\Visual Studio 2017\Projects\ProductApp\CoreScraper\bin\Debug\netcoreapp2.0\CoreScraper.dll'
   at Microsoft.VisualStudio.TestWindow.Controller.TestContainerProvider.<GetTestContainerAsync>d__61.MoveNext()

"CoreScraper" is the name of the project. When I look in that ...\netcoreapp2.0\ folder, the CoreScraper.dll is definitely in there. I am running the test by right-clicking in the test method and selecting "Run Tests". The test ran fine the very first time I ran it, but it has given me this error ever since. I've closed out of Visual Studio and reopened, deleted the contents of bin\, cleaned and rebuilt the project, etc.

Answer

aybe picture aybe · Oct 29, 2019

What worked for me:

Delete folders inside .vs folder.

But you still can't delete that folder ?

Probably because of Live Unit Testing, testhost.exe or testhost.x86.exe process is the cause.