Search code examples
c#.netvisual-studiocopyxcopy

Copy the entire contents of a project in a folder of another project, when build (Visual Studio 2013)


I've a Visual Studio 2013 solution, within 2 projects PJ1 and PJ2. My goal is to copy the entire contents of PJ1 in a folder (myFolder) situated under PJ2. In addition, the copy must occur when I perform a build for PJ1. I tried with xcopy without results:

xcopy /E /Y "$(ProjectDir)" "$(SolutionDir)PJ2\myFolder\"

Any idea?


Solution

  • Try this- Assuming PJ2\MyFolder is your output folder

    Copy build assembly and all the components in project PJ1

    xcopy "$(ProjectDir)$(OutDir)*.*" "$(SolutionDir)LambdaInXdocument\Myfolder" /E /Y
    

    Copy all the files(.cs and others) & directories where .csproj resides-

    xcopy "$(ProjectDir)*.*" "$(SolutionDir)LambdaInXdocument\Myfolder" /E /Y