Cloaked folders in the TFS Build Workspace

 

Here is a little Trick I find most people don’t know about.

When setting up a Build Definition you have to tell the build server where to get the source code from. We do this by declaring the folders to download from on the workspace tab of the build definition. It takes time to download all the files to the build server so you don’t want to get any unnecessary folders from source control.

Generally you can just select the root of the branch and pick up everything from there. Although there are times when the build you are creating does not require all the files in the branch. Lets say for example that you have two builds that run one that only builds the application and one for your WIX projects to create an install package. You likely want to keep all the files together for branching purposes. Something like this:

image

The folders in my example are for the following:
Builds files used by the build process specific to this application. Includes third party DLL’s we do not have the source code for.
Install WIX Project.
Resources Various resource files used by the application.
Source Application Source Code.

Now what I want is to get certain folders when building the app for a CI build and different ones when creating an install package.

CI Build

Install Package

Builds

Builds

Includes

Includes

Resources

Install

Source

 

I could just do this. But then I am getting more than I need in both cases.

image

 

 

 

Or to get just what I need I could do this. (Making sure I put everything into the correct folder on the build agent.

CI Build: image

 

 

 

 

Installation Package Build:image

 

 

 

 

Or I could use the cloaked status to let the build know not to get a particular folder.

Therefore on the CI Build where I want everything but the Install Folder I could do this: image

 

 

 

And on the Install Package Build I don’t need Source or Resources so I could do this:image