Yesterday I made an unexpected discovery about how Visual Studio handles excluded files.
Perhaps it is obvious (but wasn't to me) that excluding files from a build is specific to the configuration.
As part of my testing, I added a second main program to my project, and excluded the original one. The trap was that this was that I had different main programs for the Debug and Release versions, and I could not understand why the release version did not do what the code said - it appeared that 90% of the code was being inexplicably bypassed (in reality because that whole file was not being included in the Release build).
Of course, VS does indicate that the file was excluded, but the presence of a very small blue arrow on the icon is easy to miss unless you're looking for it.
Well, I guess I'm a little wiser now.