Ref:http://blog.csdn.net/teng_ontheway/article/details/8307410

Ref: http://blog.csdn.net/sodickbird/article/details/4826068

需求:

需求:可能我们需要给美工发布一个版本,那就需要*.exe, *.dll 和资源都放在一个文件夹下,然后同步给美工

问题:生成工程的时候.exe生成目录可能和资源目录不一致,总不能每编译一次都手动的把生成的.exe 和 dll拷贝到资源目录下吧

解决办法:用visual studio自带的生成后批处理命令

visual studio->右键工程->properties->Build Events->Post-Build Event->Command Line下

xcopy $(OutDir)$(TargetFileName) $(ProjectDir)..\Resources\ /Y

这个命令式功能是将生成目录下的exe文件拷贝到工程目录上一级目录下的Resources文件夹下

注意点:

1.$(OutDir)等宏路径中已经附带了'\'
2.生成后事件xcopy其实就是运行一个控制台命令,所以命令不支持‘/'
像之前写的一个错误命令

xcopy $(OutDir)$(TargetFileName) $(ProjectDir)../Resources\ /Y

运行会提示错误

3.“/Y"是参数,表示有相同文件存在则替换

当然也可以拷贝整个文件夹

xcopy "$(ProjectDir)controls" "$(TargetDir)..\app1\controls" /y /i /e /exclude:CodeFilesToExclude.txt

具体参数就要参考到CMD控制台下查看xcopy的具体功能了...

Bin Folders

Each project should write their output to a Bin folder under each of the Dev Folders. The Bin should NOT be checked into TFS, but should be created via a post-build event or by changing the project’s output path.

If post-build events are used, the following is a sample which assumes the solution in in the root directory:

@echo if not exist "$(SolutionDir)Cloud\bin\" (mkdir "$(SolutionDir)Cloud\bin\")
if not exist "$(SolutionDir)Cloud\bin\" (mkdir
"$(SolutionDir)Cloud\bin\")
@echo copy /Y "$(TargetDir)$(TargetName).*"
"$(SolutionDir)Cloud\bin\"
copy /Y "$(TargetDir)$(TargetName).*" "$(SolutionDir)Cloud\bin\"

Note:
Make sure you echo statements before
you execute them. This can help in debugging post-build failures in build log
files.

post- build event的更多相关文章

  1. Visual Studio中的Build Event

    在VS中,进行build时,可以在build之前,或者之后执行一些操作,比如把一些css,font,images文件从一个项目的文件夹复制到另一个项目的文件夹 方法: 点击项目,右键-属性-Build ...

  2. Visual Studio 的Build Event 使用

    rmdir Configuration mkdir Configuration Copy "$(ProjectDir)Configuration\Spec.config" &quo ...

  3. Creating SharePoint 2010 Event Receivers in Visual Studio 2010

    转:http://msdn.microsoft.com/en-us/library/gg252010(v=office.14).aspx Summary:  Learn how to create a ...

  4. Build 2017 Revisited: .NET, XAML, Visual Studio

    For the next couple months we're going to revisit Build 2017, each post focusing on different aspect ...

  5. TFS Build做Web应用持续集成发布的一个技巧

    由于面向接口编程的关系,许多实现往往是动态注入运行,在一个项目中直接引用实现dll编译是不合理的.通常我们会在Post Build Event中添加一些xcopy命令将运行时才需要的dll复制到输出目 ...

  6. 高性能Javascript--脚本的无阻塞加载策略

    Javascript在浏览器中的性能,可以说是前端开发者所要面对的最重要的可用性问题. 在Yahoo的Yslow23条规则当中,其中一条是将JS放在底部 .原因是,事实上,大多数浏览器使用单进程处理U ...

  7. Conditional project or library reference in Visual Studio

    Conditional project or library reference in Visual Studio In case you were wondering why you haven’t ...

  8. 15、ASP.NET MVC入门到精通——MVC-路由

    本系列目录:ASP.NET MVC4入门到精通系列目录汇总 Routing(路由) – URL url 作为广泛使用的Web用户接口,需要被重视 好的Url应该满足如下条件: URL应为获取某种资源提 ...

  9. HTML5 canvas处理图片的各种效果,包括放大缩小涂鸦等

    http://www.htmleaf.com/ziliaoku/qianduanjiaocheng/201502151385.html jQuery 缩放 旋转 裁剪图片 Image Cropper ...

  10. Visual Studio将Delop之后生成的dll或者wsp复制到指定目录

    用VS开发sharepoint项目的时候,有很多个project,每个project都会生成一个wsp包,如果手工把wsp文件找到,复制出来,拷贝到服务器上,再部署,就有点麻烦. 所以写了个批处理命令 ...

随机推荐

  1. poj 3253 Fence Repair

    Fence Repair Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 42979   Accepted: 13999 De ...

  2. hdu1561 The more, The Better (树形dp+背包)

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1561 思路:树形dp+01背包 //看注释可以懂 用vector建树更简单. 代码: #i ...

  3. iOS通知的使用

    注册:[[NSNotificationCenter defaultCenter] postNotificationName:@"changeColor" object:self]; ...

  4. 用 TWebBrowser 查找网页上的按钮,编辑框,

    Form1.wb1.Navigate(Aurl); <table> <tr> <td style="text-align:right;">< ...

  5. div宽高设置为百分比

    如果你将div的width和height设置为百分比,但是发现页面都不见了,这是因为父标签也要设置为百分比,也就是说body和html的宽高也需要设置为百分比 #containter{ width:1 ...

  6. VS2008切换设计视图卡死 停止响应

    最近VS2008出现一个问题,打开项目后很快就非常慢,特别是切换设计视图马上卡死,很久也反应不过来.网上找了几种办法,都不好使,有的说是office影响的,有的说要改注册表,都试了一下,还是没用.后来 ...

  7. 2016中国大学生程序设计竞赛 - 网络选拔赛 J. Alice and Bob

    Alice and Bob Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) ...

  8. requirejs 多页面,多js 打包代码,requirejs多对多打包【收藏】

    这段代码来自 http://stackoverflow.com/questions/20583812/grunt-requirejs-optimizer-for-a-multi-app-project ...

  9. Java中线程的生命周期

    首先简单的介绍一下线程: 进程:正在运行中的程序.其实进程就是一个应用程序运行时的内存分配空间. 线程:其实就是进程中的一条执行路径.进程负责的是应用程序的空间的标示.线程负责的是应用程序的执行顺序. ...

  10. linq 小记

    1.简单的linq语法 //1 var ss = from r in db.Am_recProScheme select r; //2 var ss1 = db.Am_recProScheme; // ...