使用随Visual Studio一块安装的devenv.com,再加上参数可以对.Net进行编译,如下

"D:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com"  d:\Projects\YourProject.csproj  /rebuild "Release"

"D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.com"  ".\Share\Projects\DGShare.sln" /rebuild Release  /Out .\build_log\DGShare.log

当然,你也可以编写批处理文件来对.net的解决方案(.sln)进行编译,如下

path %path%;c:\Program Files\Microsoft Visual Studio 8\Common7\IDE

devenv.com c:\solution1\solution1.sln /rebuild "Release" 
devenv.com c:\solution2\solution2.sln /rebuild "Release" 
devenv.com c:\solution3\solution3.sln /rebuild "Release"

...

第一份例子

@echo off
set time1=%TIME%
dir | find "build_log"  > nul      
if %errorlevel%==0 goto end       REM--如果有就跳到:end
if %errorlevel%==1 goto create    REM--如果没就跳到:create
:create
md build_log
:end

path %path%;D:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

devenv.com  ".\Share\Projects\DGShare.sln" /rebuild Debug  /Out .\build_log\DGShareD.log
devenv.com  ".\Taurus\Projects\Taurus.sln" /rebuild Debug  /Out .\build_log\TaurusD.log
devenv.com ".\DreamStudio\Projects\DreamStudio.sln" /rebuild Debug  /Out .\build_log\DreamStudioD.log
REM devenv.com ".\DreamGame\Client\Projects\DGClient.sln" /rebuild Debug  /Out .\build_log\DGClientD.log

@echo off
echo 开始时间:%time1%
echo 结束时间:%TIME%

pause

第二份例子:
@echo off

:: 手动发布sdk和工具到 build 服务器(编译服务无法使用的情况下)

set build_ver=Alpha4

echo 正在更新...

echo .

echo 拷贝 SDK 库和头文件...

xcopy /y /r /s /q D:\DGSource\DG_Game\Project2009\branches\%build_ver%\Share\SDK\Include\*.* \\build\c$\Products\Output\%build_ver%\Debug\SDK\include\
xcopy /y /r /s /q D:\DGSource\DG_Game\Project2009\branches\%build_ver%\Taurus\SDK\Include\*.* \\build\c$\Products\Output\%build_ver%\Debug\SDK\include\
xcopy /y /r /s /q D:\DGSource\DG_Game\Project2009\branches\%build_ver%\Share\SDK\Include\*.* \\build\c$\Products\Output\%build_ver%\Release\SDK\include\
xcopy /y /r /s /q D:\DGSource\DG_Game\Project2009\branches\%build_ver%\Taurus\SDK\Include\*.* \\build\c$\Products\Output\%build_ver%\Release\SDK\include\

xcopy /y /r /s /q %~dp0\%build_ver%\Debug\SDK\lib\*.* \\build\c$\Products\Output\%build_ver%\Debug\SDK\lib\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\SDK\lib\*.* \\build\c$\Products\Output\%build_ver%\Release\SDK\lib\

echo 拷贝公共 COM 组件...

xcopy /y /r /s /q %~dp0\%build_ver%\Debug\GameWorld\COM\*.* \\build\c$\Products\Output\%build_ver%\Debug\DreamStudio\COM\
xcopy /y /r /s /q %~dp0\%build_ver%\Debug\GameWorld\COM\*.* \\build\c$\Products\Output\%build_ver%\Debug\GameWorld\COM\
xcopy /y /r /s /q %~dp0\%build_ver%\Debug\GameWorld\COM\*.* \\build\c$\Products\Output\%build_ver%\Debug\TaurusDebug\COM\

xcopy /y /r /s /q %~dp0\%build_ver%\Release\GameWorld\COM\*.* \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\COM\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\GameWorld\COM\*.* \\build\c$\Products\Output\%build_ver%\Release\GameWorld\COM\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\GameWorld\COM\*.* \\build\c$\Products\Output\%build_ver%\Release\TaurusDebug\COM\

echo 拷贝编辑器等工具...

xcopy /y /r /s /q %~dp0\%build_ver%\Debug\TaurusDebug\*.exe \\build\c$\Products\Output\%build_ver%\Debug\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Debug\DreamStudio\*.exe \\build\c$\Products\Output\%build_ver%\Debug\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Debug\DreamStudio\*.dll \\build\c$\Products\Output\%build_ver%\Debug\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Debug\DreamStudio\*.ocx \\build\c$\Products\Output\%build_ver%\Debug\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Debug\DreamStudio\ModulesD\*.* \\build\c$\Products\Output\%build_ver%\Debug\DreamStudio\ModulesD\

xcopy /y /r /s /q %~dp0\%build_ver%\Release\TaurusDebug\*.exe \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\DreamStudio\*.exe \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\DreamStudio\*.dll \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\DreamStudio\*.ocx \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\
xcopy /y /r /s /q %~dp0\%build_ver%\Release\DreamStudio\Modules\*.* \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\Modules\

xcopy /y /r D:\DGSource\DG_Game\Project2009\branches\%build_ver%\DreamStudio\Projects\DreamStudio\update.ini \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\
xcopy /y /r D:\DGSource\DG_Game\Project2009\branches\%build_ver%\DreamStudio\Projects\DreamStudio\update.txt \\build\c$\Products\Output\%build_ver%\Release\DreamStudio\

echo .
echo 更新完毕!
echo .
pause

编写批处理文件编译.Net工程的更多相关文章

  1. 用批处理编译*.sln工程

    原文:用批处理编译*.sln工程 批处理是直接调用Microsoft Visual Studio 8\Common7\IDE\ 目录内的 devenv.exe ,它启动后就是IDE,提供的参数如下: ...

  2. 转:Android开发实践:用脚本编译Android工程

    转自: http://ticktick.blog.51cto.com/823160/1365947 一般情况下,我们都是使用Eclipse+ADT插件或者Android studio软件来编译Andr ...

  3. Intellij-idea 如何编译maven工程

    小编最近效应项目的要求,学习在idea上编写项目.作为一个新手遇到问题也算是正常的,重要的是把它解决,get新技能. 编写过maven工程的小伙伴们应该都知道怎么在eclipse中编译maven工程: ...

  4. 如何编写一个编译c#控制台应用程序的批处理程序

    如何编写一个编译c#控制台应用程序的批处理程序 2011-03-22 18:14 dc毒蘑菇 | 浏览 579 次 最近在网上看了一个教程,是学C#的,但是我的机子上装不上vs,所以想写一个批处理来编 ...

  5. 如何在编译Xcode-Plugin工程的时候增加Cocoapods依赖

    关于如何在编译Xcode-Plugin工程的时候增加Cocoapods依赖 以及在Mac App上使用Cocoapods的时候遇到Library not found for -lPods时的解决办法 ...

  6. Android内核驱动程序的编写和编译过程

    注意:涉及的代码为android内核代码而不是android源码. 在智能手机时代,每个品牌的手机都有自己的个性特点.正是依靠这种与众不同的个性来吸引用户,营造品牌凝聚力和用户忠城度,典型的代表非ip ...

  7. 【转】用systemJS+karma+Jasmine+babel环境去编写简单的ES6工程

    原文链接:http://www.cnblogs.com/shuoer/p/7779131.html 用systemJS+karma+Jasmine+babel环境去编写简单的ES6工程 首先解释下什么 ...

  8. msbuild 编译指定工程时构建脚本的配置

    有时候 ,我们编译windows的exe时,我们不需要编译所以的工程,我们只需要指定某个工程就好了,此时我们使用/t:工程名:Rebuild(如果要编译全部工程就把工程名去掉,即/t:Rebuild) ...

  9. Delphi:MSBuild编译dproj工程

    Delphi之命令行编译工程,传统是用dcc32来编译的,它需要设置一大堆参数. 自Delphi 2007以后,支持MSBuild编译,它直接编译.dproj工程文件,所有编译需要的东西,都已在其中设 ...

随机推荐

  1. Django配置参数可选总结

    一.可选字段参数 null blank core db_index editable primary_key radio_admin unique True or False db_colum hel ...

  2. 验证码60s倒计时前端效果

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  3. DataGridView、List<T>相关操作

    一.DataGridView数据转成DataTable 1.已绑定过数据源:DataTable dt = (dataGridView1.DataSource as DataTable) 2.未绑定过数 ...

  4. 模型构建<2>:不平衡样本集的处理

    分类预测建模都有一个基本的假设,即样本集中不同类别的样本个数基本相同,但是在实际任务中,经常会出现各类样本个数差别较大的情况,这样的样本集就是不平衡样本集,它对学习建模的性能会带来很大的影响,因此必须 ...

  5. 2018-2019-20172329 《Java软件结构与数据结构》第三周学习总结

    2018-2019-20172329 <Java软件结构与数据结构>第三周学习总结 教材学习内容总结 <Java软件结构与数据结构>第五章-队列 一.概述 1.队列是什么? 队 ...

  6. Oracle DBA学习篇之SQL_TRACE

    SQL_TRACE ; ; set serveroutput on; alter session set sql_trace=true; select count(*) from firefox; a ...

  7. MCP2515 : SPI CAN controller management

    #ifndef __MCP2515_H #define __MCP2515_H /* mcp2515.h This file contains constants that are specific ...

  8. Tasker to proximity screen off

    If you are using proximity screen off pro or smart screen off, you may know how convenient it is to ...

  9. EXC_BAD_ACCESS(code=2,address=0xcc 异常解决 及 建议不要在子线程中刷新界面

    iOS 上不建议在非主线程进行UI操作,在非主线程进行UI操作有很大几率会导致程序崩溃,或者出现预期之外的效果. 我开始不知道这一点,在子线程中进行了弹窗操作,结果程序就出问题了! 报的错误是(EXC ...

  10. 【BZOJ】【2242】【SDOI2011】计算器

    快速幂/扩展欧几里得/BSGS 经典好例题!! 三个问题三种算法…… 算法:白书(算法竞赛入门经典——训练指南)全有…… /************************************** ...