This is an old question with some good answers but every once in a while, I run into this issue and these little reminders about setting PostDeploy, etc. do nothing.
One thing I've seen in my experience is that there is, in fact, a syntax error but it's not obvious because it's invisible. VS and other file compare software (i.e. Beyond Compare) do not seem to see the invisible UTF-8 byte-order mark (BOM). Reference here.
Here is Beyond Compare showing a file compare after I removed the BOM.
Here is the BOM, before removal, displaying in SublimeText.
Removing the BOM that was accidentally added from one of my scripts fixed my build issue.