There is a /Framework:
parameter that you can specify to VSTest.
In your case, you should specify /Framework:.NETFramework,Version=v4.7.1
See more at https://msdn.microsoft.com/en-us/library/jj155796.aspx?f=255&mspperror=-2147217396
To add this parameter in a Azure DepOps yaml pipeline, use the otherConsoleOptions
argument
- task: VSTest@2
otherConsoleOptions: '/Framework:.NETFramework,Version=v4.7.1'