I use VS Code as well. I don't use the built in functionality of the compiler linking through the tasks.json file. I use a batch file to compile (I just figured out the way to do it correctly). My suggestion would be to go that route (its simple and keeps my vs code tasks file minimal). My usual work flow is to keep a command window open on the side. Call a compile batch file when I want to compile. Not a direct answer to the question but hopefully its of some utility.
-Regards,
Kane