Hmm really interesting!

What about rather than having it based on running msbuild/exec you include a specific parameter to opt into restoring the backup (or vice versa)? That way it can be much more explicit and documented next to the parameter to opt into it doing it in the first place?

On the other hand though, if you aren't executing msbuild/exec from the exe there is no point in restoring the files since nothing could have used them. Thus what you have makes common sense?

Either way it should be documented in the readme?