使用随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. mysql查询语句 和 多表关联查询 以及 子查询

    原文地址: http://blog.csdn.net/github_37767025/article/details/67636061 1.查询一张表: select * from 表名: 2.查询指 ...

  2. 解读socketserver之Tcpserver

    在解析socketserver是如工作之前,我们先看看socektserver类的继承关系图: 请求类继承关系: server类继承关系: 有了上面的继承关系图后,我们解析socketserver就轻 ...

  3. 排序算法之快速排序Java实现

    排序算法之快速排序 舞蹈演示排序: 冒泡排序: http://t.cn/hrf58M 希尔排序:http://t.cn/hrosvb  选择排序:http://t.cn/hros6e  插入排序:ht ...

  4. BZOJ.2286.[SDOI2011]消耗战(虚树 树形DP)

    题目链接 BZOJ 洛谷P2495 树形DP,对于每棵子树要么逐个删除其中要删除的边,要么直接断连向父节点的边. 如果当前点需要删除,那么直接断不需要再管子树. 复杂度O(m*n). 对于两个要删除的 ...

  5. [BJOI2010]次小生成树

    OJ题号: BZOJ1977.COGS2453 题目大意: 给你一个无向连通图,求严格次小生成树. 思路: 对于一般次小生成树,我们有一个结论:一般次小生成树一定可以通过替换掉最小生成树某一条边得到. ...

  6. Codeforces Round #196 (Div. 2) A. Puzzles 水题

    A. Puzzles Time Limit: 2 Sec  Memory Limit: 60 MB 题目连接 http://acm.zju.edu.cn/onlinejudge/showProblem ...

  7. MySQL在控制台上以竖行显示表格数据

    直接在SQL语句后面加\G即可,如: select * from user limit 10\G; 如果想要知道这些参数可以直接在命令行后面加入\?

  8. .Net 中DataSet和DataTable的 区别与联系

    1.简要说明二者关系 在我们编写代码的时候从数据库里取出数据,填充到dataset里,再根据表的名字,实例化到 datatable 中.其实使用 dataset 相当于所使用数据库中数据的副本,保存在 ...

  9. SPOJ 10628. Count on a tree (树上第k大,LCA+主席树)

    10628. Count on a tree Problem code: COT You are given a tree with N nodes.The tree nodes are number ...

  10. js 闭包范式概述

    在前几篇文章中我介绍过js的闭包,这一篇主要简单的介绍一下js中闭包的范式. 那么何谓闭包的范式呢? 首先回想一下闭包的概念,闭包是外部函数与函数内部之间通信的桥梁,通过对函数的返回,使得外部的函数能 ...