Search code examples
c#.netvisual-studiovstest

Minimal tooling required to test a .NET Framework project


I was trying to set up a CI/CD pipeline for a .NET Framework project on a windows runner. For local development the Visual Studio bundle contains all the tooling and set up required to run build and tests on the command line with MSBuild.exe and VSTest.console.exe

When setting up the pipeline, to avoid the overhead of the massive size of Visual Studio, we found Visual Studio Build Tools which contained MSBuild.exe which let us compile our DLLs to test. There was no standalone version of VSTest.console.exe available, but we were able to get the executable with the TestPlatform package. However, we were getting the following error with it : No suitable test runtime provider was found for any source in this run. (The system had .NET Framework 4.7.2 Runtime installed already, which was the version required by the Project)

When installing Visual Studio completely on the runner, we were able to get VSTest.console.exe to work with the same command.

What is the minimal tooling required to run tests with VSTest.console.exe on a windows runner? or what is the correct way to run tests on CI/CD without installing Visual Studio completely?


Solution

  • Answering my own question with the way we fixed it : @Lex Li's suggestion in a comment is how we eventually got it working.

    Using the NUnit Console Runner is the way to go for CLI based running of tests - attempting to run through the CLI with the test adapter on VSTest just wasn't working as expected, and works better as an adapter for your IDE-based testing.

    For xUnit.net projects you can use xUnit Console Runner