I had all sorts of issues getting to work reliably (using ASP.NET Core 2.1).
In the end I found that using the was simple and more reliable and worked exactly as I needed. You still leverage the advice on the use of regex.
I include my solution path, and exclude my \tests subfolders where all my test projects live. Example for CodeCoverage element in RunSettings xml file: