使用后期构建事件将文件从一个项目复制到另一个项目...VS2010 [英] Copy file(s) from one project to another using post build event...VS2010

查看:23
本文介绍了使用后期构建事件将文件从一个项目复制到另一个项目...VS2010的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含 3 个项目的解决方案.我需要将视图从一个项目复制到另一个项目.我可以通过像这样的后期构建事件复制创建的 DLL:

I have a solution with 3 projects in it. I need to copy a view from one project to another. I'm able to copy the created DLL via post build events like so:

所以我想将项目 1 '/Views/ModuleHome/Index.cshtml' 中的文件复制到项目 2 中的文件夹中.如何通过构建后事件将文件复制到我想要的项目?谢谢

So i want to copy the file in project one '/Views/ModuleHome/Index.cshtml' to a folder in project 2. How do I copy file(s) to my desired project via post-build event? Thanks

推荐答案

xcopy "$(ProjectDir)ViewsHomeIndex.cshtml" "$(SolutionDir)MEFMVCPOCViewsHome"

如果你想复制整个文件夹:

and if you want to copy entire folders:

xcopy /E /Y "$(ProjectDir)Views" "$(SolutionDir)MEFMVCPOCViews"

<小时>

更新:这是工作版本


Update: here's the working version

xcopy "$(ProjectDir)ViewsModuleAHomeIndex.cshtml" "$(SolutionDir)MEFMVCPOCViewsModuleAHome" /Y /I

以下是一些常用的xcopy开关:

Here are some commonly used switches with xcopy:

  • /I - 如果复制多个文件,则视为一个目录.
  • /Q - 不显示正在复制的文件.
  • /S - 除非为空,否则复制子目录.
  • /E - 复制空子目录.
  • /Y - 不提示覆盖现有文件.
  • /R - 覆盖只读文件.
  • /I - treat as a directory if copying multiple files.
  • /Q - Do not display the files being copied.
  • /S - Copy subdirectories unless empty.
  • /E - Copy empty subdirectories.
  • /Y - Do not prompt for overwrite of existing files.
  • /R - Overwrite read-only files.

这篇关于使用后期构建事件将文件从一个项目复制到另一个项目...VS2010的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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