Can't unbind solution from Team Foundation Server 2010 - tfs

I have some solutions that are binded to TFS 2010. But a team project collection isn't avaible any longer. I need to rebind this solutions to a new Team project Collection on this server. I tried to change Source Control (File -> Source Control -> Change Source Control). After pressing "Change Source Control" the window with the worlds "Would you like to completely disassociate solution from TFS" appeared, I pressed Yes. But when I'm trying to add this solution to this new project collection, I have the message that I cant do this, because the previous team project collection is unavailable. I've deleted tags from solution file and projects files and all *.vssscc, *.vspscc files. But I have got the similar error message after several attempts.
Message:
Team foundation server http://tfs.dynamics...etc does not exist or is not available at this moment. Technical information for the administrator: Service Team foundation not available on server http://tfs.dynamics.../<OLDPROJECTCOLLECTION>

Something is clearly remembering the old collection.
One option, if you still have access to it is to re-enable the old collection, unbind cleanly from it, and rebind to the new collection, before you decommission it. That way Visual Studio has the best chance of cleaning up or overwriting any references to the old collection before it is removed.
If it's too late, then places I'd look (in priority order) are:
Make sure you've removed the old collection/server from your 'connect to TFS server' dialogs
Make sure any workspaces for the old collection are deleted, and that the folders containing your solution/projects are mapped into the new collection's file structure. (Old mappings may prompt VS to add the bindings back in for the workspace it thinks applies to those folders)
Clear any references to the collection out from any solution and project files, and delete all the source control binding files (vssscc etc)
Search for in all files (.) in your source tree
Search for throughout your registry (proceed with extreme caution if you find anything and want to delete it)

Related

How to check in mass changes into TFS

I have a situation where a developer made mass changes to a project outside of TFS (long story), and now we want to put those changes back into TFS (files added, removed, renamed).
Of course, TFS is not like Git; if I check out the project, then delete the files from the workspace and copy over the new files, TFS won't adapt to those changes.
I have discovered that I can do a Compare from File - Source Control, and that the Compare screen allows me to mark files as added/deleted. This helps, but is a slow process for a large project, and quite prone to human error.
So, my question is: Is there an automated way to get TFS to simply add all new files and remove all deleted ones?
I don't care about tracking history of renamed files--they can be
considered "removes" and "adds."
I have tried unbinding and rebinding the workspace; this did not work for me (or I didn't do it correctly).
I am using VS 2015, TFS 2015, and I have the TFS Power Tools.
If you are using a Local Workspace then you should be able to get latest on the workspace, then copy over all the new files in Windows Explorer which will generate pending changes and file adds.
If you go into Pending Changes in Team Explorer you will have lots of detected changes for new files etc. but you can promote them to included changes.
This isn't going to deal with file renames or deletions though so it might not be the best solution.
Alternatively you could use Reconcile Changes in Version Control
In Source Control Explorer, right-click a folder, and then click Compare.
In the Compare dialog box. select the folder versions to compare.
In the Folder Difference window, right-click the folder or file you want to reconcile, and click Reconcile.
This will allow you to choose what to add or change to version control
You might try using tfpt online. I would add the /adds /deletes /diff /recursive flags as well.
I think in almost any case you will have some conflicts/manual work to do here.
There is a blog post on a possibly similar situation that used tfpt online as well: Discover File Changes Made Outside of Visual Studio
Since I did not get to try the above suggestions, I'll post the workaround I did, in case it helps anybody else. Hopefully, the above suggestions are better than what I ended up doing.
Make sure nothing is checked out
Open solution
Team - Go Offline
Close solution
Windows Explorer - Copy latest source folder into the current source folder (Windows Explorer will do a Merge).
VS - Open solutin, select solution file
File - Source Control - Advanced - Change Source Control
if you get a message about unloaded projects, make sure all projects loaded. Click "Reload" on those that didn't.
Shift to select all project, click Bind
Do a Compare in Source Control Explorer. Manually add all new files. Manually delete all deleted files. Frown.

What are "Excluded Changes" in Team Foundation Server?

When I check in changes in TFS Express 2013 using Visual Studio 2013 Professional, there is a list of "Excluded Changes" that has 1541 items in it.
I have never told TFS to exclude a change, and do not understand why anyone would even want to "exclude" a change (isn't source control all about SAVING changes???). I am a bit worried that I have changes that are not being saved...but am even unsure if this is even what it means. I have Googled for more information about "Excluded Changes" in TFS, but haven't found any explanation.
Can anyone explain to me: What are Excluded Changes? Why would I want to exclude a change? And why are there 1541 excluded changes that I never requested to be excluded? Should I be worried that changes are being excluded? Should I change these excluded changes to INCLUDED changes?
There are a number of things that can cause a "change" to be excluded:
Team Explorer will, by default, ignore files in obj/* and bin/* and a few other folders. As well as certain extensions like .csproj.user.
They're not loaded in your current solution, so Team Explorer assumes they're made as part of either a different solution and that you don't want to check them in together with the changes that do match the context you're in.
They're made in a different workspace, again Team explorer assumes you want to check in groups of files that logically make sense.
They're manually excluded from the current checkin. You may do that when you want to first check in one file that fixed Bug 123, then check in another set of files that fixed Bug 124.
Files created outside of Visual Studio are never automatically added, so when you zip up a set of .cs files and that zip ends up in your workspace folder, Team Explorer will detect it, but won't add it automatically.
There is a final issue that may be going on here, if for some reason a project hasn't been added to source control, or the bindings in the solution file were not checked in correctly, then any file added to that project will be ignored as well, as Visual Studio assumes that project should not be under sourcecontrol.
Using "Add existing project" doesn't automatically put that project under the same source control bindings as the solution. which would cause team explorer to assume 6.
The path may previously have been "cloaked" or "unmapped", mapping a folder after the fact doesn't tell Team Explorer to add them.
You may have been working offline and were using a server workspace. When you tell Team Explorer to come back online, you need to ensure that all adds are correctly done. A Local workspace doesn't have this issue, as it can locally track the changes without having to talk to the server.
You may have chosen "Check in pending changes" from a subfolder in the Solution Explorer (or on an individual item or project) or in the Source Control Explorer. When you do that, Team Explorer scopes the Pending Changes window to only the items that match that context. All other changes are temporarily moved to the "Excluded Changes" section.
You should inspect the Excluded Changes list and either ignore them using your .tfignore file. You can do this from the UI as well by right-clicking such an excluded change and choosing the option to ignore by path/extension or pattern.
Basically, if you see stuff in the Excluded Files section, either right-click/include them or add them to your .tfignore file.
That way it's at least very clear that items in that list have not been evaluated yet and most probably need to be included.
You may also want to check your source control bindings by opening File/Source Control/Advanced/Change Source Control Bindings... to ensure that all projects show as bound to sourcecontrol and don't show any errors.
Some additional context
In Git as well as in other source control systems, changes are often not automatically pended. This is to prevent you from accidentally checking in stuff that you did not intend to. In Git you need to explicitly call git add to mark a change as one that you intend to commit. Until you do that the change is considered "untracked", which is essentially the "Excluded Changes" feature of TFVC.
Subversion (SVN) has a similar behavior where changed files are marked as unversioned and need to be added explicitly through calling svn add.
So this isn't very strange behavior for a source control system. It essentially puts you in control of your sources.
Wanted to give another case where files are excluded. If you add a project from template or a new item to your project that includes a default name like "MainWindow" then rename or delete that file before ever commiting changes. "MainWindow" will be in the excluded changes and the item with new name will be in Included changes. In this case you can safely delete them.

Remove project from TFS Source Control when Collection/Team Project don't exist

I have a Visual Studio Solution (2010) containing code projects that were under source control in Team Foundation Server 2010. That collection/project no longer exists, but the code was not removed from the collection. The collection and project have been created over again exactly as it was the first time. When I open the solution in VS, it tells me that it can find my project, it is offline, and asks if I would like to go online. I click yes, but then it errors and says it can not find the workspace. All my files are read only. I assume this is because of the source control and, since it's not hooked up, I can't check them out (remove the read only).
How do I purge the solution of the old and hook everything back up again, short of recreating all the code solutions over again?
EDIT
To clarify:
Collection refers to TFS Collection
Project refers to TFS Team Project
Solution refers to VS Code Solution
The problem is the code solutions are still associated with the team project, which doesn't exist. When I open it, I get the message "This solution is offline, but its associated TFS server is available. Would you like to go online with this solution after it has loaded?" Yes "Unable to determine the workspace for this solution"
When you have loaded the projects, enable the Source Control - Team Foundation Server tool bar, click the "Change Source Control" button (only one enabled) and it asks you if you wish to permanently remove the association with source control.

Corrupted TFS project

I'm banging my head for several hours but couldn't find the solution on my problem. I have a team project collection. one of the project in collection is corrupted probably. It doesn't show up either in Team Explorer nor in TFS Administrator. but I can see that project in Source Control Explorer from VS. I tried TFSDeleteProject but it says:
TF200016: The following project does not exist:........
I can't create a team project with same name, nor I can delete it.
I looked at the database and there are entries about the corrupt project in many tables. Any idea how to remove it? maybe with the help of some SPs? I tried DeleteProject stored procedure, it didn't show an error, but it also didn't delete the project.
thanks.
Have you tried simply deleting it from source control?
TFS is comprised of several components (issue tracker, reports, source control, etc.), which, although typically used together, can also function individually. A file/folder in source control that does not belong to any project is thus possible. I don't know if you can create this situation manually, but it could result from a bug.
You need to use tfsdeleteproject to remove this.
The DB isn't corrupt, you cannot delete Team Project level source control folders through the UI.
tfsdeleteproject /collection:<url> <teamproject|srcfoldername>
You can always get the collection url by selecting the collection node in Team Explorer and hitting F4 to view the properties pane. Copy/paste the url. The Source Control folder you are trying to delete is likely the same as your Team project name.

Exclude from project, source control issue

I'm using team foundation server 2010 # work and home.
I want to exclude some element from the project build but still have them exist in Team Foundation Server 2010 source control. How do I achieve this?
Exclude From Project will delete the item.
Same problem here, only way to do this is manually edit project file :(
Please vote that this bug is important to fix
https://connect.microsoft.com/VisualStudio/feedback/details/573582/vs-2010-exclude-from-project-deleting-files-from-source-control
Workaround posted on Connect:
Open the csproj file in notepad and find the files that need to be
excluded and remove or comment the compile element for that file, and
any related designer and resx files.
Editing a project file and removing the references to the files you want to exclude would be the easiest solution.
Another solution would be to remove files from the project via UI, but only checkin changes in the project file and undo the delete operations.
In the future you can add files directly to the TFS folder in Team Explorer.
May I ask: why would you want to do that? As I commonly have a problem of files which are not bound to any project and have to be getted manually.
I work in a TFS environment, and if it were me? I'd just change the name of the file (instead of excluding it from the project), and check that in instead. Since your project is expecting that particular filename...it won't find it. We use this when we're developing prototypes or holding on to antiquated code for documentation purposes. Sorry VS is eating your stuff!
Kind Regards,
-sf
I think these steps should help you do what you are looking for.
To exclude an item from a deployment project:
In Solution Explorer, select the file you want to exclude.
On the Solution Explorer toolbar, select Properties.
In the Properties window, set the Exclude property to True.
And this page explains the actions for project files supported by VS 2010:
http://msdn.microsoft.com/en-us/library/0ebzhwsk.aspx
--- Edit ---
At work I tried 'Exclude From Project' in one of the files of a project we have in VS 2010, which is bound to a TFS 2010 server, and this action did not delete the item from TFS; the Source Control Explorer window shows the red delete mark next to the item, and the 'Pending Change' column says delete, but item is there. Right click the item in the Source Control Explorer window, one of the commands in the context menu that pops-up is 'Check In Pending changes' and another one is 'Shelve Pending changes'. Shelving enables you to set aside the pending changes.
The file is still in the local hard drive. If I do 'Include In Project' the item comes back to normal.

Resources