FrankVDB
FrankVDB

Reputation: 235

TFS Builds - Put several files from other folders to one folder after building

In TFS Builds component I try to do this for instance, to put these files:

In one file such as: \Main\dll

I can do manually, for each folder, but if I have so much files I don't want to do that manually.

What I'd like

Thank you for helping me!

Upvotes: 1

Views: 346

Answers (2)

phifi
phifi

Reputation: 3028

You can use the MSBuild Arguments to achieve this. Just add the OutDir argument to the Build Solution Step like this:

/p:OutDir=$(Build.BinariesDirectory)

enter image description here

In this case, all of your files will end up in the Binaries Directory of your Build Agent. e.g. "C:\Agent1_work\1\b"

Of course you could also use a different target folder than whats inside the variable $(Build.BinariesDirectory).

Upvotes: 0

Tingting0929
Tingting0929

Reputation: 4192

Add a Copy File step after the VS Build step. And in the Copy File step, set like the picture below: the Contents could be **\bin\$(BuildConfiguration)\*.dll and make sure that the Flatten Folders is checked.

enter image description here

Note: The Flatten Folders only exists in TFS 2017 Update1 and upper version for on-premises. VSTS also has it. But in TFS 2017 and TFS 2015, it doesn't have.

So, if you are using lower version of TFS, you need to use 2 Copy File steps and copy the 2 dlls to the Main Folder separately. Or you could download the latest source code(it has the FlattenFolder option) of that step from here. Then package it and upload to your TFS as a custom build step.

Upvotes: 1

Related Questions