VS 2010.构建后.将文件复制到多个目录/多个输出路径 [英] VS 2010. Post-build. Copy files in to multiple directories/multiple output path

查看:39
本文介绍了VS 2010.构建后.将文件复制到多个目录/多个输出路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 MVC 项目,我想拆分它的输出.

I have a MVC project and I want to split its output.

我想把这个项目的所有DLL文件(Bin目录下的所有内容)复制到一个目录,把所有View(View目录的内容)复制到另一个输出目录.

I want to copy all DLL files of this project (all content from the directory Bin) to one directory, and all Views (content of the directory View) to another output directory.

VS 2010 中项目的设置不允许我简单地这样做.

Settings of the project in VS 2010 does not allow me to do that simply.

我只能在设置中指定一个输出路径,我无法指定要复制的目录或文件类型以及位置.

I may specify only one Output path in settings and I can't specify which directories or file types to copy and where.

我认为我应该将输出目录保留为默认值,然后我需要使用 Post-build 命令按照我想要的方式拆分输出.

I think that I should leave the output directory to its default and then I need to split the output like the way I want using Post-build command.

也许有人做了类似的事情并且有任何想法如何做得最好?

Maybe someone did something similar and have any ideas how to do it best?

推荐答案

解决方案是

1) 将输出路径设置为要在项目属性中复制 *dll 文件的目录

1) Set Output Path to directory where you want to copy your *dll files in project properties

2) 使用 post-build 事件将目录 View 的内容复制到你想要的任何目录

2) Using post-build event to copy the content of the directory View to whatever directory you want

就我而言

1)输出路径我设置为

..\MyDestinationProjectName\Bin\

..\MyDestinationProjectName\Bin\

2) 复制视图目录的构建后事件如下所示

2) Post-build event to copy View directory looks like this

xcopy "$(ProjectDir)\Views" "$(SolutionDir)\MyDestinationProjectName\Plugins\Views\$(ProjectName)\"/s/i/y

xcopy "$(ProjectDir)\Views" "$(SolutionDir)\MyDestinationProjectName\Plugins\Views\$(ProjectName)\" /s /i /y

这篇关于VS 2010.构建后.将文件复制到多个目录/多个输出路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆