How can I exclude vcxprojs from dotnet test?

  .net-5, c++, msbuild

I have a solution of .NET 5 SDK-style csprojs that works with dotnet build and dotnet test. I’d like to add a C++ project to it (pure C++, not C++/CLI), which breaks these.

The error I get is

error MSB4019: The imported project "C:Microsoft.Cpp.Default.props" was not found. Confirm that the expression in the Import declaration "Microsoft.Cpp.Default.props" is correct, and that the file exists on disk.

which is caused by dotnet not supporting C++. Fair enough. I can work around dotnet build by just using msbuild but what can I do for dotnet test? I don’t care about testing the C++ project, just want to keep existing functionality working. If I could somehow make it exclude vcxprojs that would be great.

Source: Windows Questions C++