MsBuild.exe [Path to your solution(*.sln)] /t:Build /p:Configuration=Release /p:TargetFrameworkVersion=v4.0
Building C# Solution in Release mode using MSBuild.exe
MsBuild.exe [Path to your solution(*.sln)] /t:Build /p:Configuration=Release /p:TargetFrameworkVersion=v4.0