Unable to find testhost.dll. Please publish your test project and retry

前端 未结 19 1369
星月不相逢
星月不相逢 2021-02-01 11:40

I have a simple dotnet core class library with a single XUnit test method:

TestLib.csproj:


  
            


        
19条回答
  •  耶瑟儿~
    2021-02-01 12:14

    I've encountered this a couple of times and I always forget what's up. Most recently I had:

    • Class Library -> Targeting .NET Core 3.0
    • Test Project -> Targeting .NET Core 3.1

    Packages for my test project:

    • Moq -> 4.14.1
    • xUnit -> 2.4.1
    • xUnit.Runner.VisualStudio -> 2.4.2

    I was seeing:

    Unable to find C:\PATH\bin\Debug\netstandard2.0\testhost.dll. Please publish your test project and retry.

    And all that I needed to do was add to my test project the missing nuget package: "Microsoft.NET.Test.SDK"

    Everything was back to normal at this point.

提交回复
热议问题