I usually deploy my web application by right clicking on the app and selecting the publish option. VS copies everything to a local file system folder then I zip it up and copy it to the web server.

For some reason when I publish my branch the binary in the publish folder is different from the binary in the local build folder. It's as if it's building different code.

Both the local build and the publish are using Debug (Any CPU) configuration.

Here's a screenshot of the decompiled assemblies.

This first one is the one from the project bin folder and runs perfectly.

This one is from the publish folder and as you can see it contains some lines which aren't in the other build.

This particular class doesn't have any #IF DEBUG pragmas in it.

I've tried clearing out the bin and obj folders with no success.

Does Visual Studio have a cached copy of all the code somewhere that it uses to do the publish build that I can clear out?