0

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.

Community
  • 1
  • 1
moggizx
  • 476
  • 1
  • 5
  • 19

1 Answers1

1

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)

James Woolfenden
  • 6,498
  • 33
  • 53
  • This works on command line for a single solution at a time, thanks! But.. I can't seem to make it work in the MSBuild task? Doing this doesn't seem to do anything different at all: – moggizx Oct 31 '14 at 10:03
  • Oh, my bad... DestFolder started with .\ which of course evaluated to the solution directory... I should be able to work the rest out on my own now :) – moggizx Oct 31 '14 at 10:08