MSBUILD结合批处理编译

@echo off
set FrameworkPath=%SystemRoot%/Microsoft.NET/Framework/v4.0.30319
if exist "%FrameworkPath%/MSBuild.exe" goto :Start
set FrameworkPath=%SystemRoot%/Microsoft.NET/Framework/v3.5
if exist "%FrameworkPath%/MSBuild.exe" goto :Start
set FrameworkPath=%SystemRoot%/Microsoft.NET/Framework/v3.0
if exist "%FrameworkPath%/MSBuild.exe" goto :Start
set FrameworkPath=%SystemRoot%/Microsoft.NET/Framework/v2.0.50727
if exist "%FrameworkPath%/MSBuild.exe" goto :Start
set FrameworkPath=%SystemRoot%/Microsoft.NET/Framework/v1.1.4322
if exist "%FrameworkPath%/MSBuild.exe" goto :Start
color 0A
echo 没有合适的编译器!
color 00
PAUSE
EXIT
:Start
for /f "delims=" %%i in ('dir /b /a-d  "*.sln"') do (
   %FrameworkPath%/MSBuild.exe %%i /t:Build /p:Configuration=DEBUG
)
:END
PAUSE

 

放到和sln同级的目录下,for循环下有时候可能会提示不能指定多个项目,需要自己把项目名填进去,去掉for

posted @ 2012-09-30 10:45  Bug山Bug海  阅读(357)  评论(0编辑  收藏  举报