I am using TFS 2010, and I am trying to test the cloaking functionality. I have nearly identical build definition files for each environment (dev, qa, prod) - they only differ (for testing purposes) in that I want to cloak a particular directory for dev and qa, and then make it active for prod.
I did this (edit build definition - workspace - choose directories and if they are active or cloaked.) but I get an error (Could not find a part of the path 'CloakTest\CloakFile.txt') when the build definition tries to build.
Thoughts?
Cloaking causes a source controlled folder to "disappear" from your workspace. If you use it to "hide" something your build needs, your build will fail.
You are trying to use a file in your build that has been hidden by cloaking it. So either don't cloak it, or if it's not needed, remove that file from your Project/Solution.
Cloaking is usually used to avoid getting files onto your dev PC that you don't need. Imagine you have five projects in source control but you only work on three of them - you can cloak the other two so that your drive isn't cluttered with projects you're not interested in. It will also speed up "Get" operations.
Another way cloaking can be used is when you have several sets of equivalent files that you wish to swap between - you can cloak one and map another one in its place. However, this is a bad practice that should be avoided unless you have a very strong reason for doing so - it introduces unnecessary complexity and avoidable failure-points/fragility into your development process, and things could get really messy if you start branching as well). A better approach in most circumstances is to place the files side by side and use build configurations or some other form of conditional compilation to make your build use the appropriate files.