TFS 'All files are up to date' - visual-studio

Issue
I get 'All Files are up to date' with TFS's 'get latest' (Both at the parent directory and solution level) when they clearly aren't (there are a few folders that others have checked in that I am not getting). I can see they exist locally in the appropriate location (which is most certainly mapped) but I absolutely can not get them added to solution explorer.
I'm in VS 2013.
What I've Tried
1) Drag and drop the folders from the file explorer. Doesn't work - VS apparently doesn't allow this.
2) Right click the parent folder in Solution Explorer click 'Add -> existing item'. Apparently you can't add an entire folder, so adding individually is no good as there are over 2000 items in all the sub-directories.
3) Right click, 'Source Control -> Get Specific Version' check both boxes regarding overwriting.
4) Repeat step 3, but first delete folder in the file explorer. The files get re-added to file explorer, but not Solution Explorer.
5) I found this Visual Studio Solution Explorer not showing files and folders and tried it, also to no avail.
6) Multiple combinations of all the above steps, restarting VS, etc.
Thanks!
EDIT 2/24/2016
Adding this here as a reference diagram for my comment in response to the answer, as I can't use new lines in a comment.
File Structure:
FooFolder
|-foo.txt
|-BarFolder
|--bar.txt
In the above example, you still have to ctrl+click through foo.txt and bar.txt separately, since select all would include the folders and disallow add to solution.

If you see the "missing" files on your local file system after a Get Latest then they are correctly in Source Control. To add the files to your project you need to Show All Files then you can right click each and Include in Project:
To add files to the solution right click and choose Add | Existing Item:

Related

Solution Explorer not showing files after Get Latest

I am working with another dev and we're using TFS for source control. When he checks in a file or folder, I can see them with Source Control Explorer. I can do a Get Latest, and I can see that the file or folder is pulled down to my local file system.
However, if I flip over to my Solution Explorer, his new files or folders aren't appearing. I have clicked refresh, I have done a Get Latest from Solution Explorer, I have done a Get Specific Version from Solution Explorer.
Is there something I'm supposed to do to have them show up? Do I need to do an Add Existing Item every time he adds something to source control?
Thanks,
Chris
Adding files to source control is not the same thing with adding files to a project.
You are supposed to see the files on source control also.
To be able to see the files on solution explorer you need to add files to existing project by "Add Existing Item" option.

On add existing item in VS2010, why can't I "add as link" a file from the same project?

I have two folders in my library project, folder A and folder B. Folder A will contain all the real files, but Folder B (and a bunch of other folders) need to contain links to the folder A files.
I tried going Add existing item (go to folder A)-> add (down arrow) -> add as link but the add existing item dialog window just closes and nothing happens. It seems I can add links to files outside the library project though. What's going on here?
-Isaac
For some reason Visual Studio seems to silently ignore possible problems with adding file as a link. I just had the same problem and the solution was to:
Check if project folder already contains a file with the name of file being linked, if so delete or rename this resource.
Visual Studio 2010 seems to cache project directory contents, as (1) was not enough to successfully link the file. Restarting VS helps.
Sound like Visual Studio is crashing for some reason. I just tested this in project that has many folders. I had an images folder and I was able to add as link and image to another folder, so it seems it is possible.
It does add the file to the project but does so to the original location, not the new location.
You can see this if you exclude the original file from your VS project (but don't delete the file from disk) - the file will then get add to your project in it's original location
e.g. if you have folder FolderA\index.htm and FolderB, and you want to create a link to index.htm in FolderB. Exclude index.htm from your project (but leave it in FolderA on the disk) so your project just has two empty folders. Right-click on FolderB and click Add Existing Item, select index.htm from FolderA and click Add as Link. The file will be added to your project but under FolderA (where it resides on disk) not within FolderB which is where you told it to add it.
So looks like a VS bug to me.
As has been mentioned, this is a valid scenario if you have multiple "root" websites within one project but you want to share resources between them
In my case (using Visual Studio 2013) I just had to show all files (button on the top of the Solution Explorer), right click on each file/folder and click on "Include on Project".

Add folder to solution explorer

How i can add folder with all files and subfolders to my project in solution explorer?
Click on Solution Explorer Show All Files. Right click on folder. Include in Project.
Follow these steps to successfully add a new folder to a project. I personally like to add new folders via Source Control Explorer
Step 1 - Create new folder via Source Control Explorer
Step 2 - Select 'Show All Files' to display new folder in solution explorer
Step 3 - Include folder in project
Get latest. Modify the folders in your C: Drive, or wherever you put the objects from the solution. In the solution explorer click on Show All files (Thanks x2, this helped me so much!) Right click to Include in Project.
This helped me to add new schemas with all their subfolders while avoiding the problems with Writing updates...

Deleting a folder in TFS

I created a folder in a TFS Project under workspace "CPortalWS". I deleted the workspace, but now I would like to delete the folder in the project and the delete option is not available.
I've tried to create a new workspace mapped to the project but I still don't get the option to delete.
Is this a bug in TFS? How can I delete the folder?
Any help would be appreciated.
Deleting a folder in TFS is a little strange.
You have to:
Create a Workspace
Get the latest source for the folder (to your local machine)
Inside Source Explorer, delete the folder
Check in your changes (this is the step that deletes the folder in Source Control)
only note that delete is not an actual delete.
the folders/files are still there and kept in Version Control, for example for Undelete scenarios.
You can see them and avail the undelete function if you go to "Tools > Options > Source Control > Visual Studio Team Foundation Server" and check "Show deleted items in the Source Control Explorer" and then right-click on one of the deleted folders.
so, if you want real delete, where the folder/files actually go away you need to use the Destroy Command which is only available from the command line, see link below
http://msdn.microsoft.com/en-us/library/bb386005.aspx
When you delete in TFS, it does not remove it from TFS. It maintains a copy of the deleted files, even when you check in the deletion. This can cause some issues.
To permanently delete from TFS, you need to issue a tfs destroy command.
To do this:
Open a Visual Studio Command Prompt.
Issue the following command: tf destroy $/SourceLocation/Folder. Where $/SourceLocation/Folder is the Source location of the deleted folder in TFS.
Please note: This command will also delete the file(s) from disk.
I had a similar issue, where I had 1 folder which despite being deleted from Hard drive, was still showing as in Source Control (with a green + by the folder). It also showed me the content but if I tried to open any, an error message informed me the file wasn't there.
Clicking on any folder didn't show the delete button. I then realised that selecting a file did! If you don't have a file, create a text file and add it to the folder you want to delete (via Source Control). Click this file, note the delete shows. Select a folder and note that the delete disappears but only after half a second. This small delay is actually usable.
I clicked the file, so the delete button is enabled and hovered the mouse above the delete button. Using the keyboard, I did a CTRL + A and as soon as all files and folders were selected I clicked left mouse button. And it worked! Everything was removed, including (and this is the odd thing) the parent folder.
Create a Workspace; and get latest on the base folder; Dont forget to cloak the relevant folders. If you are going to delete the subfolders then cloak all and get latest on the base folder. So you save a lot of time in pulling files.

Visual Studio solution that just points to a folder and shows all sub-folders and files in the solution explorer?

Is there a way to create a blank solution, or some type of file-based project solution within Visual Studio so that I can point to a root folder, and have all of the sub-folders and files in that root, show up in my solution explorer? I realize I can create a blank solution and then add the individual items manually by add > existing item, however, this does not keep the folder structure intact, and, well, it would take forever if I have a lot of folders/files.
You can also create the blank solution and then click the second-from-the-right icon at the top of the solution explorer (it looks like three files with one "cut out"). Once you click that button to show the files in the solution directory that are not in a project, you can select all the files (with shift-click) and then right-click on your selection and select "Include In Project."
Also note you can select multiple files in the "Add Existing..." file window with shift- or control-click.
You have to create a Visual Studio Project inside your solution to be able to add files with keeping their folder structure. The files to be added must reside below the project's main folder.
I suggest adding a "C# Empty Project" (Solution Explorer: Solution > Add > New Project ... > Visual C# > Windows > Empty Project). After that you can proceed as described by SoloBold to show the files in the project folder. Right click on the topmost folder of your source files an select "Include In Project" and the whole folder structure including all files will be added. This may take some time depending on the number of files / subfolders.
See also: Answer to similar question, with screenshot

Resources