Fixing build and test process on Windows

Closes #2006