AakashM
AakashM

Reputation: 63378

Why do I get the error "The item ... may not be cloaked because it does not have a mapped parent" when trying to cloak a sub-sub-folder from a build?

I'm using TFS 2015 to build a C# solution. Deep within the folder structure of this solution are folders containing certain large non-code data files. I would like some builds to include these, and some builds to exclude them.

Using the TFS 2015 web interface, I set up the build that should exclude these files. I then use the Repository tab and add the data folders to the Mappings section with a Cloak type mapping.

However, when I then queue this build, it fails with "The item ... may not be cloaked because it does not have a mapped parent".

The top-level folder in the code repository is mapped, of course. Why is TFS complaining about this, and what can I do about it?

Upvotes: 3

Views: 7130

Answers (4)

Muhammet Can TONBUL
Muhammet Can TONBUL

Reputation: 3538

Check this quick solution. Solved my problem.

http://jawedm.blogspot.com/2013/05/error-in-team-foundation-server-this.html

  1. In the Source Control Explorer window, right click the parent node -- the context menu appears
  2. Click the Remove Mapping... option in the context menu -- the Remove Mapping dialog appears
  3. Check the boxlabeled, Recursive

  4. Click the Change button -- a prompt appears, stating, "Newly mapped items will not be downloaded until you execute a get. Do you want to get $/[PARENT PATH] now?", where "[PARENT PATH]' is the path of the parent node

  5. Click the No button -- the prompt and Remove Mapping windows disappear, and then the Get window appears
  6. CAUTION: Use your best judgement here! I decided to click the Cancel button in the Get progress window, to prevent mapping child objects

Upvotes: 0

Jeremy Thompson
Jeremy Thompson

Reputation: 65692

ProjectXYZ / Drop ' cannot be cloaked because it does not have a mapped parent.

Another way to get this error is if you specify a Sln file in the Map:

enter image description here

The correct place to specify a single Sln file is in step 1 the Process.

Upvotes: 1

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51153

Your solution is just the accurate one for this issue. I will only add one more point which related to why.

In TFS, a cloaked path means the path is not included in recursive mapping of its parent folder. When your workstation has source code in the parent's mapped directory, and the source code has not been added to source control, the local directory is considered to be cloaked.

In simple terms, just as the error info mentioned, this is by designed, a 'Cloaked' folder cannot be cloaked if the folder does not have a mapped parent. For more details, you could take a look at related info of cloak in MSDN Link: Optimize your workspace using explicit, implicit, cloaked, and non-recursive folder mappings

enter image description here

Upvotes: 2

AakashM
AakashM

Reputation: 63378

I don't know the why, but I do know that to fix this problem you need to just read the error message:

The item ... may not be cloaked because it does not have a mapped parent

So if you have ended up with this sort of repository structure in the failing build:

Type   Server Path                    Local Path
Map    $/Project                      $(build.sourcesDirectory)\Project
Cloak  $/Project/Assets/Data/Data2013
Cloak  $/Project/Assets/Data/Data2014
Cloak  $/Project/Assets/Data/Data2015

You just need to add one more line like so:

Map    $/Project/Assets/Data          $(build.sourcesDirectory)\Project\Assets\Data

Now, the items you are attempting to Cloak have a "mapped parent", and your build should succeed.

You might think that the fact that the whole repository tree is 'mapped' would be enough, but apparently not.

Upvotes: 5

Related Questions