人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

May 19, 2006

VS 的 Build Events

Filed under: Visual Studio

在vs2003 和2005中都支持了Build Events, 但是2003只支持单行的命令,而2005可以支持多行命令.

要想在2003中执行多行命令,只能把命令写在一个批处理文件中,然后通过调用批处理来执行.

1.在Solution explorer中用context meun查看project的property.

2.选择Build Events,可以看到Pre-build 和Post-build event command line,以及运行Post-build event 的条件

//——————————————————

用法收集

1.build完后修改build产物的名字(后缀),并覆盖已有的同名文件.

copy $(TargetFileName) $(TargetName).XXX y

2. 调用外部命令或批处理:

call "C:\Program Files\XXX.exe"

3. 条件判断:

IF NOT $(ConfigurationName) == Release GOTO end

    call "C:\Program Files\XXX.exe" $(ProjectDir)$(TargetName).cvp

:end

4.web project 自动部署

copy     $(TargetDir)*.*     \\MyServer\MyService\bin
copy     $(ProjectDir)*.ascx     \\MyServer\MyService

//——————————————————

Macro收集

$(DevEnvDir)

$(ProjectDir)

$(BuiltOuputPath)

$(ConfigurationName)

$(TargetName)  不含扩展名

$(TargetFileName)  包含扩展名

MSDN中的 Pre-build Event/Post-build Event Command Line Dialog Box 一节有所有的Macro

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/05/19/vs2005-build-events/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham