As itowlson pointed out you could also use the Build Engine APIs
... from MSDN ...
// Build a project file
bool success = engine.BuildProjectFile(@"c:\temp\validate.proj");
You can use MSBuild from a script such as a batch file. And just check the ErrorLevel for something other than 0... or you can have fun with the APIs.
C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe
.. from msbuild.exe /? ...
Microsoft (R) Build Engine Version
2.0.50727.4927 [Microsoft .NET Framework, Version 2.0.50727.4927]
Copyright (C) Microsoft Corporation
2005. All rights reserved.
Syntax: MSBuild.exe
[options] [project file]
...
Examples:
MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release
MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug