I had the same problem, and found that the solution is just to restart VS before publishing, you dont have to do anything else.
For the same reason, always publish to a new empty folder, so you can see the actual output, if any.