You are probably having an issue with the data through put, see the knowledgebase article below which shows how to slow the speed of the USB comport, you will need to go to windows 10 Device manager and under your usb comport, go to advanced settings and changed the latency number to 3.
https://www.digi.com/support/knowledge-base/target-communication-errors-using-dynamic-c-with-w
To compile without having the target board, go to options, project options, targetless and select your board then go to compile and select compile to .bin file.