2

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.

enter image description here

Thoughts?

DaveShaw
  • 52,123
  • 16
  • 112
  • 141
dah97765
  • 679
  • 1
  • 13
  • 29
  • Are you sure that what you're building doesn't reference something in the cloaked folder? i.e. a solution reference, something included in a project as content, etc? – Richard Banks Aug 13 '11 at 01:13
  • It does. I am realizing that what I was trying to use the cloaking for is not what I need to achieve this. Thanks for the answer. – dah97765 Aug 15 '11 at 15:43

2 Answers2

4

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.

Jason Williams
  • 56,972
  • 11
  • 108
  • 137
  • (copying my goal from above comment): Eventually I want to exclude the robots.txt file that we use for production to not be included when we build for DEV and QA. We have different build definition files for each environment, so I can cloak the file for the dev and QA, and leave it active for PROD. At least, thats what I was hoping I could do. It seems like cloaking is not my answer to this problem. Do you have other specific suggestions as far as best practices for that? – dah97765 Aug 15 '11 at 15:00
  • There isn't any need to cloak small individual files just to keep them out of other builds - as long as they don't reference them, they won't care about the file, so it's easier just to "leave it lying around". Just set up the other build configurations to work and ignore any "surplus" files. The main reason to cloak would be to remove a folder with a large overall size, just to speed up Gets and reduce disk usage/clutter. – Jason Williams Aug 15 '11 at 16:13
  • how to exclude a project from tfs Continous Integration build?(i want to exclude telerik mobile app project for CI Build) – ManirajSS Apr 14 '16 at 12:30
  • A CI build has a source code mapping in its definition, so you should be able to cloak (or not map) the folder to stop the build taking the source code. If the project is referenced from anywhere within the solution(s) that are built then you will need to create a build configuration in those solution(s) that do not build the project, and use that for your CI build. – Jason Williams Apr 17 '16 at 22:15
1

What are you trying to achieve? If you want to map a different set of content into that location for your prod build, then you'll want to have both the cloak and an additional mapping that maps in the alternate set of content to the same location in the source tree.

Jim Lamb
  • 25,355
  • 6
  • 42
  • 48
  • my goal: Eventually I want to exclude the robots.txt file that we use for production to not be included when we build for DEV and QA. We have different build definition files for each environment, so I can cloak the file for the dev and QA, and leave it active for PROD. At least, thats what I was hoping I could do. – dah97765 Aug 15 '11 at 14:50