How can I completely remove TFS Bindings - tfs

I have a solution that contains a good deal of projects,
I would like to remove the source control bindings completely, how can I do this?
Update:
What I really want to do is move one solution and its projects from TFS 2005 -> 2008. Thats why I am removing the bindings, is there a better way to do this?

File -> Source Control -> Advanced -> Change Source Control and then unbind and/or disconnect all projects and the solution.
This should remove all bindings from the solution and project files. (After this you can switch the SCC provider in Tools -> Options -> Source Control -> Plug-in Selection).
The SCC specification prescribes that all SCC providers should implement this behavior. (I only tested it for VSS, TFS and AnkhSVN)

I have no File -> Source Control menu in Visual Studio because I've never used TFS with this installation of Visual Studio.
My problem was I was opening a solution from the internet and the original author had forgotten to remove the TFS bindings, so every time I open the solution I'd get an annoying popup saying
"Go Offline
The Team Foundation Server http://some-other-guys-tfs-server/
is currently unavailable.
The solution will be opened offline."
To get rid of this, I deleted the .suo next to the .sln file, and then opened the .sln file in Notepad and deleted this entire section:
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {xxxxx}
SccTeamFoundationServer = http://some-other-guys-tfs-server/
SccLocalPath0 = .
SccProjectUniqueName1 = xxDemo\\xxDemo.csproj
SccProjectName1 = xxDemo
SccLocalPath1 = xxDemo
EndGlobalSection
Save the .sln in Notepad and then open in Visual Studio, problem solved.
Update: Saveen Reddy has created a tool to do this. I haven't tried it though.

The simplest solution would be to open Visual Studio, deactivate the TFS Plugin in Tools > Options > Source control and reopen the solution you want to clean. Visual Studio will ask to remove source controls bindings

If anyone needs to do this outside the context of the Visual Studio application - via command-line for example, I wrote a small tool which will strip the source control bindings from Solution And Project files. The source is available here: https://github.com/saveenr/VS_unbind_source_control

Next works for me:
Delete all .vssscc (solution binding) and .vspscc (project binding) files
Remove block GlobalSection(TeamFoundationVersionControl) = preSolution from solution file
There could be also information regarding source control in the proj file in tags
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
SAK states for "Should Already Know", so it can be kept.

Old post, so just adding to the answers of #Matt Frear and #Johan Buret. Both work.
But in Matt's case, you also need to set these (VS 2012) in Notepad/text editor:
SccProjectName = ""
SccAuxPath = ""
SccLocalPath = ""
SccProvider = ""
To each project in the solution file (.sln).
#Johan's answer effectively does this....

Sometime, the binding info is cached
To clear Team Explorer's cache:
Go to C:\Users\<user>\AppData\Local\Microsoft\Team Foundation\2.0
Delete or rename the Cache folder.
This come from a website I could not find now. Thanks for that guy for the tip.

You could try using this tool which automatically removes the Team Foundation Bindings from a project.
http://www.softpedia.com/get/Programming/Other-Programming-Files/Team-Foundation-Binding-Remover.shtml

I found this tool that helped me get rid of a tfs binding complitly its found here
https://marketplace.visualstudio.com/items?itemName=RonJacobs.CleanProject-CleansVisualStudioSolutionsForUploadi
it creates a zip with the removed source binding without modifying the orginal project.

In visual studio 2015,
Unbind the solution and project by File->Source Control->Advanced->Change Source Control
Remove the cache in C:\Users\<user>\AppData\Local\Microsoft\Team Foundation\6.0

In VS2017
go to Home in Team Explorer
Click on Settings in project section
Click on Repository Settings in Git section
From next window see Remotes section. you will see option for remove
NB: I check that for git repository

The other option is
Delete the workspace
re-map when needed
Make sure to check, rollback (Undo Pending changes)
before you remove workspace
This is quickest and surest one
Good Luck

Go to File -> Source Control -> Advanced -> Change Source Control (if change source control doesn't appear, click on solution in the solution explorer then try again)
Unbind solution and all projects
Now right click on solution and you will see "Add Project To Source Control". if you want to add project to source control again you might be get some errors that ask you to change the solution folder on TFS. it happens because your solution has some mapping in a workspace yet. remove mapping or delete workspace. now your solution is completely unbind and unmapped from TFS or workspaces.

Here you can find another tool (including source code) to remove both SCC footprint from the solution and project files and the .vssscc and .vspscc files. In addition, it removes the output and other configurable directories.
Hth
Stefan

Related

How to disconnect project solution from TFS in Visual Studio 2017 or 2019?

I have a solution which was connected with TFS. Whenever I try to install new library in the solution, I get an error:
Unauthorised (410)
I have tried to delete all TFS-related files from solution, but I'm still getting that same error.
Has anyone faced the same issue and resolved it somehow?
Verified solution
SOLUTION 1
For permanently and completely detach the solution from source control, Do the following steps:
Click the 'No' button to avoid connecting to TFS.
In the file menu, go to the source control options and clear the bindings. You'll specifically want File menu - Source Control - Advanced - Change Source Control...
Save the solution.
Next time you open the solution you won't be prompted to connect to TFS.
SOLUTION 2
To completely remove TFS source control binding follow these two steps:
Go to your solution's folder, find and delete all files with *.vssscc and *.vspscc extensions.
Open your solution's .sln file in Notepad, and find & remove the GlobalSection(TeamFoundationVersionControl) section.
Reference Link
From: Remove TFS Connection From Solution
Afaik, errors starting with 4XX is caused by wrong credentials. With that perspective, you can try disconnect from the server then reconnect via from Team->Disconnect from server
Also unbind the project and bind again;
File->Source Control->Advanced->Change Source Control
Hope, it helps.
Make sure you have deleted all related files locally. To completely remove TFS source control binding follow these two steps:
Go to your solution's folder, find and delete all files with
*.vssscc and *.vspscc extensions.
Open your solution's .sln file in Notepad, and find & remove the
GlobalSection(TeamFoundationVersionControl) section.
GlobalSection(TeamFoundationVersionControl) = preSolution
<code> SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = <YourTFSURL>
SccLocalPath0 = .
SccProjectUniqueName1 = .
SccLocalPath1 = .
EndGlobalSection
More detail steps please take a look at this blog here: Reference Link .
If you still get issue, also close VS, clear TFS and VS cache. Then open VS again, which may do the trick.

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.

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.

TFS: Choose which Team Project to add a solution too

I have a solution which I developed in VS2008 and which I am trying to add to Source Control (TFS 2010, though the issue happened in TFS 2008 as well). I have several TFS workspaces on my computer and I have access to several Team Projects.
When I right click the solution in my Solution Explorer and choose the "Add Solution to Source Control" option I am never given an option of choosing which Workspace or which Team Project to add the existing solution to. VS2008 then proceeds to add it to the same team project every time. I have tried selecting an alternate workspace/team project in every window where I can see an option for it but it always adds it back to the same one. I even tried changing the name of my new workspace so that alphabetically it was the first thinking that it might be somehow related to that; no luck.
I then tried going to the Change Source Control window where you can add/remove bindings on a solution/project but that window also defaults to the same Team Project as trying to add the solution directly does.
In my experience, the add to source control mechanism tries to use the physical path of the solution to determine which TFS project it belongs to. You could try to move the solution by right-clicking on the solution folder in the Source Control Explorer and choosing "move" to move it to the TFS project of your choice.

Team Foundation Server How to Edit file without checking it out

i'm working with TFS and i need to edit file localy without checking it out .
another case if some one checked in the file and i need to change my locally copy.
what should I do ?
in Visual source safe we can do that by removing the read only check on the file.
Ok, this is relatively easy in VS2010, and quite normal. I mean the locking model of source control is obsolete anyway.
In vs2010, click Tools -> Options -> Source Control -> Environment and select Allow checked-in items to be edited. This should stop the TF client from marking files as read-only.
Also you may have to change the Editing drop-down in Source Control -> Environment to Do nothing.
Well.. You can certainly unmark the file as read only and edit it in something other than visual studio. Or, you can still use visual studio, but not edit it when the solution it's a part of is opened..
Quite frankly, I'd look into other options with regards to why
1. that file needs to be in source control.
2. If it does need to be in source control, why does your copy need to be different.
Just unset the read-only flag on the file locally.
You may have some issues later when try to do a "Get Latest" operation, which will warn you about a locally writeable file.

Resources