Search code examples
tfstfsbuildtfs-2015

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?


Solution

  • 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.