Code: Rescue from NullReferenceException.
Fixes: #1434.
Merge pull request #1427 from DotNetSparky/nullfix

Fix NullReferenceException error during build when looking for CompileOnBuild settings.