xunit / visualstudio.xunit

VSTest runner for xUnit.net (for Visual Studio Test Explorer and dotnet test)
https://xunit.net/
Other
146 stars 81 forks source link

An assembly specified in the application dependencies manifest (testhost.deps.json) was not found: package: 'Microsoft.TestPlatform.CommunicationUtilities', #420

Closed TerjeMyk closed 5 days ago

TerjeMyk commented 1 week ago

I want to test xUnit for first time. I had a NET 8 project that needed som test, so installed:

dotnet add package xunit.v3 --version 0.4.0-pre.20

Complie the project - no error. Then I do this:

PS C:\Project\XXX> dotnet test Determining projects to restore... All projects are up-to-date for restore. Test run for C:\Project\XXX\bin\Debug\net8.0\xxx.dll (.NETCoreApp,Version=v8.0) VSTest version 17.11.0 (x64)

Starting test execution, please wait... A total of 1 test files matched the specified pattern. Error: An assembly specified in the application dependencies manifest (testhost.deps.json) was not found: package: 'Microsoft.TestPlatform.CommunicationUtilities', version: '17.11.0-release-24352-05' path: 'Microsoft.TestPlatform.CommunicationUtilities.dll' Testhost process for source(s) 'C:\Project\XXX\bin\Debug\net8.0\xxx.dll' exited with error: Error: An assembly specified in the application dependencies manifest (testhost.deps.json) was not found: package: 'Microsoft.TestPlatform.CommunicationUtilities', version: '17.11.0-release-24352-05' path: 'Microsoft.TestPlatform.CommunicationUtilities.dll' . Please check the diagnostic logs for more information.

Test Run Aborted.

I have tried to install Microsoft.TestPlatform - but it did not solved the problem.

There was a simular case here, be it was closed before it was solved:

What shall I do to install this missing file?

TerjeMyk commented 1 week ago

Found the issue.

I added the test directly to my project. When I made a seperate xUnit project and put my test there. And then I reference to my project I want to test, it worked.