Pre Build Event: Copy Folder and it's SubFolders and files into Build Directory using XCopy

前端 未结 4 1994
死守一世寂寞
死守一世寂寞 2020-12-29 23:37

I have Window Application and I have some plugins & it\'s ChildPlugins which I placed in My Application folder structure(see folder structure image). I used SVN as sour

相关标签:
4条回答
  • 2020-12-29 23:40

    I have used this:

    xcopy "$(ProjectDir)MyFolder\*.*" "$(SolutionDir)ConsoleApplication1\bin\Release\MyFolder" /Y /I /E
    

    And worked fine, the folder 'MyFolder' appear into my 'Release' folder when I compile the project with all the documents in it.

    Something to point out here is that the path that is after $(SolutionDir) would change depending of the name of your solution, my solution is ConsoleApplication1.

    0 讨论(0)
  • 2020-12-29 23:47

    Better if it doesn't require a path with solution name or configuration type:

    xcopy "$(ProjectDir)MyFolder\*.*" "$(TargetDir)\MyFolder" /Y /I /E
    
    0 讨论(0)
  • 2020-12-30 00:04

    Here is an example of copying Assets folder (located in the project folder) into bin(debug or release ...)\Assets

    <Target Name="BeforeBuild">
        <Exec Command="xcopy &quot;$(ProjectDir)Assets\*.*&quot; &quot;$(ProjectDir)bin\$(Configuration)\Assets&quot; /Y /I /E" />
    </Target>
    

    Note, double quotes are replaced with a special word

    0 讨论(0)
  • 2020-12-30 00:05

    You need to add the /E switch to copy subdirectories (including Empty ones).

    0 讨论(0)
提交回复
热议问题