22 February 2011

Fix TFS "Cloaked Path" Problem

Here's the situation you're likely facing: you've been tasked to add a Visual Studio (VS) solution to an Team Foundation Server (TFS) as a Team Project (TP). You launched Visual Studio or the TFS Web interface, and then navigated to the TP in the Source Control Explorer. You dragged the solution folder from Windows Explorer into Source Control Explorer. The Add to Source Control dialog appeared, but you notice the following:
  • The Items to add tab says "(0)", indicating no items will be added
  • All files are listed in the Exlcuded items tab
  • The status message below the item tabs reads, "This item cannot be added because its destination path is cloaked"
  • You are asking yourself, "What the heck is a cloaked path?"
You probably tried simply clicking the Finish button instead of the Next > button, but receive a message stating, "No eligible items were found for addition."

Well, there is an easy solution for that!

About TFS Version Control Cloaked Path

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.  Basically, TFS doesn't know anything about the existing code, and may be encountering naming conflicts.


How to Fix the Cloaked Path Problem

The first thing to check is that your mapped folder name and path do not exceed the operating system limit. Please search Google for the maximum path and name length for your OS and version; I will not attempt to list and maintain them here.

As I mentioned above, a cloaked path simply means the parent directory is not recursively mapping folders.  We want to add a child folder map.  These two conditions are mutually exclusive.  To resolve the issue, simply change the parent map to be recursive.

Please be sure to follow the steps for your version of Visual Studio. The process has changed, over time.


Visual Studio 2013

  1. In the Source Control Explorer window, right click the parent node -- the context menu appears
  2. In Visual Studio 2012 and 2013, click the Advanced sub-menu
  3. Click the Remove Mapping... option in the context menu -- the Remove Mapping dialog appears
  4. Check the box labeled, Recursive
  5. Click the Change button -- the Consolidate Mappings window appears
  6. Click the YES 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
  7. Click the No button -- the prompt and Consolidate Mappings windows disappear

Visual Studio 2012

  1. In the Source Control Explorer window, right click the parent node -- the context menu appears
  2. Click the Advanced sub-menu
  3. Click the Remove Mapping... option in the context menu -- the Remove Mapping dialog appears
  4. Check the box labeled, Recursive
  5. 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
  6. Click the No button -- the prompt and Remove Mapping windows disappear, and then the Get window appears
  7. CAUTION: Use your best judgement here!  I decided to click the Cancel button in the Get progress window, to prevent mapping child objects

Visual Studio 2010

  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 box labeled, 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

After following these steps, adding items should function normally. You are now the hero of the office! Bask in the glory. (Now is a good time to ask for a new software license or vacation time.)

32 comments:

  1. Thank you! I want to say something snarky about Microsoft making that *so* obvious, but I'm so thrilled to have a solution I will resist. :)

    ReplyDelete
  2. Thanks, your solution worked for me.

    ReplyDelete
  3. Thanks a lot, you made my day :-)

    ReplyDelete
  4. thanks a lot, it helps :)

    ReplyDelete
  5. Great post. Thanks a ton!

    ReplyDelete
  6. Thank you, solved my problem

    ReplyDelete
  7. I also want to add my praises - thank you!

    ReplyDelete
  8. Thanks a lot! really helpfull article.

    ReplyDelete
  9. Snikitha varma21 May, 2013 04:14

    Thanks for the solution :)

    ReplyDelete
  10. Thanks for the tip

    ReplyDelete
  11. thanks a lot !

    ReplyDelete
  12. Thanks a ton. It worked :)

    ReplyDelete
  13. In 2012 the "Remove Mapping" feature is under the "Advanced" menu option

    ReplyDelete
    Replies
    1. Update to my Update:

      Steps for VS 2012 and 2013 have been added. The process changes subtly, with each generation.

      Delete
  14. This tip works - thank-you so much.

    ReplyDelete
  15. Yes, many thanks. I was tearing out what little remains of my hair as it is.

    ReplyDelete
    Replies
    1. We all need a little hair tearing, to truly appreciate when tools work nicely the first time.

      Delete
  16. You're a godsend .. thank you

    ReplyDelete
  17. Thanks Mike, this post just made a tiresome morning setting up new TFS projects (there's always something new that goes wrong / I forget how to do!) slightly less annoying than it would have been. Much appreciated.
    Mark

    ReplyDelete
  18. Hi ,

    Thank you very much.. it worked for viso2013

    ReplyDelete
  19. Thank you from Stockholm.
    /Dan

    ReplyDelete
  20. Thank you...

    ReplyDelete
  21. thank you so much !! it was very very helpful

    ReplyDelete
  22. Thank you for making me a hero at work :)

    ReplyDelete
  23. I got the same error message but in my case the path and file name are too long. So after renaming the file, I was able to add to the TFS successfully

    ReplyDelete
    Replies
    1. Ah, that is a situation I have not encountered. Good find, and thank you for reporting it.

      Delete
    2. I updated the post to include checking the path and name length.

      Delete
  24. This comment has been removed by the author.

    ReplyDelete
  25. Worked with vs2015 after I cleaned up my own poor attempts and finally googled.. LOL and *sigh*

    You would think after all these years, MS would figure out that this is a problem THEY should address..

    Either way, THANK YOU!! :)

    ReplyDelete

Please provide details, when posting technical comments. If you find an error in sample code or have found bad information/misinformation in a post, please e-mail me details, so I can make corrections as quickly as possible.