0
votes

I have an MSBuild script that builds all solutions in my repository, but now I need a way to copy all of the output to a build directory. I was trying to use the Output parameter in the build task to know which files to copy, but RecursiveDir can't be used with that parameter: MSBuild RecursiveDir is empty (you can see my build script here too). Anyway, I have this folder structure:

Repository
|
+- Solution1
|   |
|   +- ProjectA
|   |   |
|   |   +- bin
|   |       |
|   |       +- Release
|   |
|   +- ProjectB
|       |
|       +- bin
|           |
|           +- Release
|
+- Solution2
|   |
|   +- ProjectA
|       |
|       +- bin
|           |
|           +- x86
|               |
|               +-Release
|                  |
|                  +- images
|
...etc

Basically, I just want to copy the contents of each Release folder, including subfolder structure and contents, into the following structure:

Build
|
+- Solution1
|    
+- Solution2
|    |
|    +- images
|
...etc

I.e. I want to strip the Project\bin\platform\configuration part of the path. I don't want to have to manually include each project, because new ones pop up every so often and it would be nice not to have to update the build script every time. Seems simple enough but I can't figure it out...

I've seen MsBuild Copy output and remove part of path but I don't really understand it so I don't know how to apply it here.

1

1 Answers

1
votes

Have you tried overriding the output path parameter? For example if you call msbuild on each solution

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe $(SolutionName) /p:OutputPath="%CD%\Build"

This will redirect your output from your projects with no configuration to deal with. Just look in \Build for your output (Its content depends on your project type)