The easiest way to build a .NET solution (or a project) from the command line is to use devenv command.
However, there are two devenv files - devenv.com and devenv.exe. Today, I have noticed one really essential difference between them. The former one is a console tool, while the latter one is not. If you type devenv.exe to build a solution, it will start a background process and immediately return control to the console. It means that, if devenv.exe is used in a batch file, the commands succeeding it may be executed before the build process completes.
The above happens only when you type something like devenv.exe SomeSolution.sln /Rebuild Release in the command line and hit Enter. It does not happen when such a command is used in a batch file.