Cannot debug a unit testing project in Visual Studio 2012

前端 未结 2 1866
别跟我提以往
别跟我提以往 2020-12-17 14:43

I couldn\'t find a post similar to this, so I hope this isn\'t a duplicate.

I have a c# class library that I\'m trying to run unit tests on in Visual Studio 2012. I\'

相关标签:
2条回答
  • 2020-12-17 15:04

    Ensure that you used the "unit test project" template when creating the visual studio project which contains your test. Visual studio needs some metadata in the csproj markup to now how to execute a class library.

    You can add it or confirm it is present by editing the csproj file in notepad:

    <Project>
     <PropertyGroup>
      <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     </PropertyGroup>
    </Project>
    

    Details @ http://onlinecoder.blogspot.ca/2009/09/visual-studio-projects-project-type.html

    Now it should work with F5 in Visual Studio. If it still doesn't work, right click on the test and click 'run tests' or use the test explorer (Test > Windows > Test Explorer)

    0 讨论(0)
  • 2020-12-17 15:20

    You'll want to debug it a different way:

    enter image description here

    0 讨论(0)
提交回复
热议问题