VS Background Builds
Two MSBuild related things that I keep losing track of every few years that are incredibly hard to discover.
Logging Background Builds
Visual Studio does a number of background (or "Design Time") builds on your behalf. They don't log anywhere by default. If you want to look at what is going on you need to "set TRACEDESIGNTIME=true" in your environment and launch VS. This will dump diagnostic builds to your "%temp%" folder in the form of "ProjectName_TargetName_unique.designtime.log".
Using a Build Task as a Custom Tool
Finding the documentation for Custom Tool is hard enough, let alone the fact you can invoke a specified MSBuild task. Set the Custom Tool property to "MSBuild:targetName" and a background build will fire whenever the file changes.
You'll need to turn on the background build logging as described above to see what is going on.
One last related note: IVSSingleFileCodeGenerator is the normal interface involved for Custom Tools.