Not sure how to do it in a macro, but you could do it in a batch file with ms build. Run the "Visual Studio 2005 command prompt" and type msbuild /? From the help messages:
Examples:
MSBuild MyApp.sln /t:Rebuild /p:Configuration=Release
MSBuild MyApp.csproj /t:Clean /p:Configuration=Debug
Hope that helps.
ChrisB