What happened to Exclude from Source Control - visual-studio-2013

I remember that in the past I was able to Exclude selected files from Source Control. But now this is missing:
How do I get it back. I want to exclude permanently, for example the photos folder.

This feature can now be found in the Pending Changes window:
You must first undo any pending changes on this item if there are any.
And you can specify a .tfignore in your source control system to make TFS automatically ignore files (the above mentioned dialog will create or update this file through the UI)

Related

How to add to visual studio solution a file that exists in TFS?

I've deleted a file by accident. Then I created another file with the same name. When I tried to check in the change, it didn't work out and got an error. I undid the changes then deleted the file, there's no more error when I try to check in.
I'd like now to get the latest version of the file before I deleted it.
Thanks for helping.
In TFS, a deletion only takes effect when you check in the said deletion change, and thankfully, this operation is reversible.
Here are the most common recovery scenarios, assuming that the file already had revisions stored in TFS before the accidental deletion:
If the file is still visible in the Source Control Explorer and is marked for deletion (under the Pending Change column):
Then it means that you've deleted the file from your solution (and file system), but that you didn't checked in the changes yet.
Use the "Undo" command of its contextual menu to restore the file in your workspace to its latest version before deletion.
From there, you'll be able to add the restored file to your solution.
If the file is still visible in the Source Control Explorer and is not marked for deletion:
Then it means that you've deleted the file from your file system.
Use the "Get Specific Version" command of the file's contextual menu to restore it in your workspace. In the "Get" window, select "Latest Version" and enable both options.
From there, you'll be able to add the restored file to your solution.
If the file is not visible in the Source Control Explorer:
Then it means that you've checked in the deletion change.
Turn on the "View deleted files" option of the Source Control Explorer (usually the 2nd button of its toolbar) to see your deleted file.
Use the "Undelete" command of the file's contextual menu to restore it in your workspace.
From there, you'll be able to add the restored file to your solution and you'll eventually have to check in the undeleted file to make it available to others, since this file only exists in your workspace.

Why .tfignore doesnt work at all?

I followed the instructions in this Microsoft article, but they don't work.
I created .tfignore file, put it in the root, here its content (I want to exclude these folders).
When I open Team Explorer - Pending Changes, I see these folders are included in Pending Changes
A way to solve the issue is updating your VS to VS2015Update 3. The .tfignore should be indeed working correctly.
If those files already in the pending changes before you add your .tfigonre file in source control. You can try below solution:
If the changes are "still" in pending changes, first create a backup
copy, then make an Undo on them. Close VS, restore the backup copies
and then it should work.
Or you can try to use a temporary quick fix for the problem:
Add an $ char into the bower_components folder name in the .bowerrc. TFS does not allow the $ character in the file name, so it can't be added to source control.
More detail ways you can refer this blog from GitHub: Things in ".tfignore" still are shown in pending changes

Visual Studio 2015 new files not being added to source control automatically

I have just upgraded to VS2015 and I am experiencing an issue I have not seen before. Using an existing solution under source control, I am able to modify files and they get picked up as pending changes ready to check in to TFS.
However, I add a new file (Test.cs as an example in this screenshot), it is not picked up as a new file.
I am required to right-click it and click "Add files to Source Control"
This has never been an issue before. I would like everything I add as a new file to be picked up as a pending change. How can I make this happen? I have not seen this before in previous Visual Studio versions.
I can confirm that this issue is the same on another machine. Also, the new file is not picked up in "Promote Candidate Changes" either.
If I then click "Add file to Source Control", I get this message.
"The selected file is ignored. Add it to source control anyway?"
My .tfignore file just has a directive to ignore packages, so I don't think this file is the problem.
How can I get my settings back on track?
UPDATE:
I have noticed that this only happens to the "Release" branch of my workspace. All other branches behave as expected. Furthermore, if I then take a branch "Release" and call it "Release1", the issue goes away entirely!
Do branches with the specific name "Release" take on any special functionality in TFS?
Folders called Release and their contents is automatically excluded from TFS (along with Debug and lots of file types). You can override this for particular folders by creating a .tfignore file, as detailed in the "Customize which files are ignored by version control" section of this link
Customize which files are ignored by version control
By default certain types of files (for example, .dll files) are
ignored by version control. As a result:
When you add ignored files to folders that are mapped in a local
workspace, they do not appear in the Pending Changes page in Team
Explorer.
When you try to add ignored files using the Add to Source Control
dialog box (for example by dragging them into Source Control
Explorer), they automatically appear in the Excluded items tab.
You can configure which kinds of files are ignored by placing text
file called .tfignore in the folder where you want rules to apply. The
effects of the .tfignore file are recursive. However, you can create
.tfignore files in sub-folders to override the effects of a .tfignore
file in a parent folder.
.tfignore file rules
The following rules apply to a .tfignore file:
# begins a comment line
The * and ? wildcards are supported.
A filespec is recursive unless prefixed by the \ character.
! negates a filespec (files that match the pattern are not ignored)
.tfignore file example
Ignore .cpp files in the ProjA sub-folder and all its subfolders ProjA*.cpp
Ignore .txt files in this folder *.txt
Ignore .xml files in this folder and all its sub-folders
*.xml
Ignore all files in the Temp sub-folder \Temp
Do not ignore .dll files in this folder nor in any of its sub-folders !*.dll
We were also experiencing this issue but in our case it was because we had folders that ended in ".Lib". Figured it out from this SO question: Visual Studio 2015. Files not added to TFS
We have the same issue because of a branch called 'Release'. But the issue is only at Visual Studio 2015 Update 3. Using Visual Studio 2015 Update 2, everything is ok. So Visual Studio Update 3 must have been changed its behaviour. It would be useful to return to its old behaviour.
Add a .tfignore file to the release folder containing the extensions you want it to not ignore:
!*.vb
I tried adding this to the .tfignore that existed in my solution folder and it didn't help. It only worked when I added one to the parent release folder.
..\Release
..\Release\.tfignore <-- this one
..\Release\SolutionA\
..\Release\SolutionA\.tfignore
msdn thread on the subject

How do I get Visual Studio Team Foundation Server to see I moved code to a different folder?

I moved some code from my c drive to my d drive. When I opened the solution, it told me that:
The solution appears to be under source control, but its binding
information cannot be found. Because it is not possible to recover
this missing information automatically, the projects whose bindings
are missing will be treated as not under source control.
So I tried permanently removing the bindings and downloaded the latest version. Now my changes don't register as pending changes.
I've tried selecting the solution in the Solution Explorer and File => Source Control => Change Source control, but it does not let me bind. Server Name and Server Binding columns have "".
Generally speaking, the location of code on your machine is dependent upon where your workspace is located.
If you move your workspace to the D: drive, then there shouldn't be an issue.
However, if you simply used Explorer to copy the files to the new location, then VS isn't going to be able to maintain the bindings.
From the Workspace Editor you can map the entire tree, solutions or even individual projects to a new location.
First off, put it back and undo the changes.
Then, Go to File | Source Control | Workspaces.
Click on the work space name and then the "Edit..." button.
In the working folders area select the source control folder you want to move and give it a new local folder location.
You will need to edit your Workspaces for TFS Server to know the change that has happened at your local machine. To edit your workspace, in Visual Studio:
ensure you have no pending changes; also copy your source code folder to some location temporarily, just to be safe (you can remove after you are all set)
go to Source Control Explorer
locate the "Workspace:" dropdown
select the item "Workspaces" from the dropdown list (you will get a dialog titled "Manage Workspaces"
if you have multiple Workspaces, select the appropriate one from the list in the dialog
click on "Edit" button (you will get an "Edit Workspace..." dialog)
down below in the dialog, you will see "Working folders" grid
click on appropriate row from the grid and modify the "Local folder" path to set to your new folder location
Sometimes TFS and Visual Studio have issues in getting these workspace changes synchronized. I would always close Visual Studio and re-launch it to get my changes synchronized anytime after I make Workspace related changes.
Hope this helps.
the most crude way here (I don't know if there is any other way)
is to put the folder back to its old location , Check in your changes
then remap the project to the new folder
When you move files/folders to make the moves pending changes you need to use a TFS client to do the moves.
For one or two files the Team Explorer UI is OK, for more the command line is easiest.
See tf.exe rename on MSDN (tf move is an alias for rename). There is also step by step help on using the GUI: Move, Rename, and Delete Version-Controlled Files and Folders.

Borland Starteam incorrect files status

I have some project saved in starteam. As there are a lot of obsolete files I can't check in or check out all project, only changed files. Now I copy project from one computer to another for other developer. I expect starteam treats copied project as new item for check in and check out, but it don't.
Forexample:
I modified file on first computer.
I update list of files on second computer and see this file in "check in" list, as I modified it on second computer.
It is incorrect.
I think there is some configuration file or something like, that saves computer (or user) settings. So when project is copied, settings is copied too.
Do anybody know how to change this configuration to set copied project as new instance of starteam???
You should be able to Right-Click on either the file or a close group of files (such as the Modified group) on the file tab within a project and choose the Update Status option. This will cause StarTeam to analyze the file to try to determine if they truly are the same as what is in source control. Then you can refresh the list and it should change most of your files to current.
There is also a configuration setting under Tools->Personal Options->File tab that is "Use file checksums (MD5) to calculate status". This may be useful to you as a different way to have StarTeam determine if the file on your local disk is the same as what is in source control.
It sounds like you are using a custom filter/query for your check-in list. The status for the files that are copied/moved would be "unknown" and they can still be checked-in by checking the "force check-in" checkbox in the check-in dialog. Just verify that the local version is correct by using compare contents before committing it.
You can try switching from a central file status repository to a "per folder" repository. This will create .sbas folders wherever you check-out files and should maintain status for local files when their containing folder is copied or moved. Look under Tools, Personal Options on the File tab under Repository.

Resources