As a developer, I want my compiler (MSBuild in Visual Studio in this case) to fail badly whenever it contains a file in any csproj
project that is missing on disk. This idea sprung out at me after witnessing an accidental deletion of a web.config from a web site. MSBuild happily compiles without it (and would do so in continuous integration as well, since that just runs MSBuild too).
Is there a way to force MSBuild to check that all files referenced in all of a solution's projects are present before making a build succeed? Enabling Warnings as Errors doesn't seem to do it. In fact, viewing the output, I didn't see any notice that a file was missing. I know it flags missing files for project files marked "Compile", but what about content-only ones?
It indeed appears that if a Content item is set as "Do not copy" then it will not cause an error or even a warning in MSBuild. However, if you set it to either "Copy if newer" or change the type to "Resource" (still leaving it on "Do not copy") then it will trigger an error. I was able to make a random .bak file a "Resource" with no adverse effect on my build that I could tell.