Copy file(s) from one project to another using post build event...VS2010
xcopy "$(ProjectDir)Views\Home\Index.cshtml" "$(SolutionDir)MEFMVCPOC\Views\Home"
and if you want to copy entire folders:
xcopy /E /Y "$(ProjectDir)Views" "$(SolutionDir)MEFMVCPOC\Views"
Update: here's the working version
xcopy "$(ProjectDir)Views\ModuleAHome\Index.cshtml" "$(SolutionDir)MEFMVCPOC\Views\ModuleAHome\" /Y /I
Here are some commonly used switches with xcopy
:
- /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.
xcopy "your-source-path" "your-destination-path" /D /y /s /r /exclude:path-to-txt- file\ExcludedFilesList.txt
Notice the quotes in source path and destination path, but not in path to exludelist txt file.
Content of ExcludedFilesList.txt is the following: .cs\
I'm using this command to copy file from one project in my solution, to another and excluding .cs files.
/D Copy only files that are modified in sourcepath
/y Suppresses prompting to confirm you want to overwrite an existing destination file.
/s Copies directories and subdirectories except empty ones.
/r Overwrites read-only files.
xcopy "$(TargetDir)*$(TargetExt)" "$(SolutionDir)\Scripts\MigrationScripts\Library\" /F /R /Y /I
/F – Displays full source & target file names
/R – This will overwrite read-only files
/Y – Suppresses prompting to overwrite an existing file(s)
/I – Assumes that destination is directory (but must ends with )
A little trick – in target you must end with character \ to tell xcopy that target is directory and not file!