VS 2010. Post-build. Copy files in to multiple directories/multiple output path

后端 未结 3 1928
死守一世寂寞
死守一世寂寞 2020-12-15 06:33

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

I want to copy all DLL files of this project (all content from the directory Bin) to one directory, and all Vi

相关标签:
3条回答
  • 2020-12-15 07:18

    The solution is

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

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

    in my case

    1) Output path i set to

    ..\MyDestinationProjectName\Bin\

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

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

    0 讨论(0)
  • 2020-12-15 07:21

    This should be a comment to @caiosm1005, but I lack points. As indicated by @Riapp use the xcopy command. A detailed explanation of the switches can be found here Xcopy and Xcopy32 Switches

    My solution was: xcopy "$(TargetDir)$(TargetFileName)" "C:\Mydestination" /s /i /y

    The TargetDir contained the full path to the compiled file and the TargetFileName is the combination of TargetName and TargetExt. Do not add a backslash separator after a directory variable e.g. $(TargetDir)\$(TargetFileName) will fail because it will be interpreted as "TargetName**\\** TargetExt".

    Once you look at the values in the Macros it should be easy to choose what you want. Remember you need to do this on each project within your solution. The build events can be found by right clicking on the project, selecting properties and then choosing the Build Events tab.

    0 讨论(0)
  • 2020-12-15 07:24

    This should be a comment to caiosm1005, but I lack points. As indicated by Riap use the xcopy command. A detailed explanation of the switches can be found here Xcopy and Xcopy32 Switches

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