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

前端 未结 19 1416
星月不相逢
星月不相逢 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:02

    In my case the problem was that I have an extension project for xunit. There is also a test project to test the extensions. When I ran dotnet test on my solution, my extension project was also picked up as a unit test project (it took me some time to realize this). The reason for this is that it references some xunit packages. One of these xunit packages automatically sets the true property in you csprj file. This is actually a good thing since 99.99% of the projects that reference xunit are actually unit tests. I could finally solve this by explicitly setting

         
    ...
            false
    ...
          
    

    Manually in my csproj file. Then the problem went away.

提交回复
热议问题