Some projects not showing TFS Menus - visual-studio-2010

I have 8 projects in my solution. 3 of them are not showing any TFS menus when I right click on the project or any of the files from Solution Explorer. They are in TFS though, if I go through the Source Control Explorer I can manually check them out/in. Also those 3 projects do not have associated .vspscc which the other 5 projects do. Something must have got messed up but I am not sure what. How can I fix this so that I get those TFS options back in Solution Explorer. Having to manually check out/in is not practical.
edit: I've tried wiping my local copy and bringing the solution down from source control again. I've also removed those projects from the solution and re-added them which did not work.

It sounds like 3 of your projects have lost their source control bindings. You should be able to restore them easily. Just go to the Change Source Control dialog, which will allow you to set the source control bindings for all the projects in your solution:
File > Source Control > Change Source Control...
Then you'll need to enter your TFS server name and the server path for the projects that have lost their bindings.

Edward got me pointed in the right direction, for me it was an issue of TFS having gone offline.
Resolution: I selected the Solution level in Solution explorer, then went into File>Source Control> and selected the Go Online menu option, which restored all of my right click TFS menu options.

Related

Visual Studio 2010 source control disappearing from Solution Explorer

Symptoms
When I open a certain WPF solution in Visual Studio 2010, after the solution loads and is displayed in Solution Explorer, for a moment, I see the source control icons (locks, checkout checks, etc) next to the items in the solution and then they disappear, except for check marks for checked out files. Right clicking any of the items without an icon shows a context menu without any of the source control actions. The checked items can be checked in and then the source control actions disappear for them too. If I open the Change Source Control dialog, the solution and all of the projects have the red line under them indicating they are invalid.
I can unbind each of them, then rebind them to the exact same Server Name and Server Binding successfully. This causes solution explorer to temporarily become source control-enabled again. But if I click the refresh button on solution explorer, I get a dialog stating:
An error occurred while accessing the source control system. Do you want to disable source control for this session.
This causes the solution explorer to lose source control interoperability again.
Yesterday, I tried to download the latest of a different solution that I had update on another machine. I found that somehow the new files I had added to the solution on the other machine were not in TFS. So I excluded them from the project and re-included them to add them to TFS. Then on my machine did Get Latest again. The solution updated so it knew the files should be included but it didn't download the files themselves. I tired Get Latest with Replace files even if the local version matches the server version and they still didn't download. I had to specifically get each file from Source Control Explorer. This may be unrelated but I wanted to include it in case it's not.
What I've Tried
To try to solve the first problem, I reset all VS settings and restarted. This didn't work so I shut it down. I uninstalled TFS Power Tools and that didn't work either. I replaced my .sln and .vssscc with the latest from TFS. I unselected TFS as the source control plug-in and reselected it. Uninstalled the NuGet Package Manager extensions, which also did not help. I don't have any add-ins and the only extensions I have installed now are a few Telerik control extensions, which are not new.
Why are the source control bindings becoming invalid?
Delete the .vssscc file and let Visuasl Studio recreate it when it reloads the project solution.
Try file » source control » change source control . Unbind and rebind .

Visual Studio 2012 project lost link to TFS

So I came back to a project that I was working on a few months ago, and when I load it one of the projects seems to have lost the link to it's entry in TFS. The solution explorer doesn't show the lock icons for it, but I still see it in TFS.
I tried performing a add to source control but it says that the items already exist.
Anybody have ideas on how to fix this?
I'm trying to avoid remapping because there are a few branches, and I'm not even sure that will fix it.
Your solution has lost the TFS binding, you can do the following to fix it. First open the solution/project you wish to bind in Visual studio then:
Highlight the project or solution you wish to bind to Team Foundation version control in Solution Explorer.
On the File menu, click Source Control, and then click Change Source Control.
3.In Change Source Control dialog box, click Bind.
MSDN Link
Update for VS 2013 (thank you Caad9) - In VS 2013 [Ultimate at least] there's an additional level in the menu; File - Source Control - Advanced - Change Source Control... which brings up the dialog

How to have TFS 2010 detect changes done to files outside of Visual Studio?

I'm using Team Foundation Server 2010 with Visual Studio 2010.
Whenever I modify a file outside of Visual Studio, TFS doesn't seem to detect the change done to the file, and thus doesn't offer me the option to check-in the file after it has been modified.
How can this be solved?
TFS has a "Reconcile" command for this:
Open the Source Control Explorer
Right-click on the folder with the changes and choose Compare
Select the files you want to reconcile (press CTRL+A to select all files)
Click on the Reconcile button
Set the options in the Reconcile Folder Differences dialog. Make sure Files that do not have pending changes is set to Check Out
Click OK
If you have local changes the Check Out dialog will be shown. Set the preferred Lock type
Click Check Out
See also: Reconcile differences between folders
If you have a network connection to your server while you're working outside of Visual Studio, it's probably best to go ahead and check the file out before editing it, either using the tf command line client, or using the Windows Explorer shell integration that's available in the TFS Power Tools release. (Plus an increasing number of other tools have TFS integration that makes this automatic, but if you're just using notepad, this still needs to be a manual step.)
Of course, there are many times when you're working and you don't have a network connection available that allows you to check out the files.
If you know what files you've modified, you can just check them out from within Visual Studio, then you'll be able to check them back in.
If you don't know what files you've edited, you can detect the changes by running the tfpt online command (also part of the Power Tools release). This will locate the files that have been modified locally and check these files out from the server.
This worked for me, using the TFS Power Tools:
tfpt online /adds /deletes /diff /noprompt /recursive directory-name
(where directory-name is the path to the directory to be updated, otherwise it will detect changes throughout your entire TFS repository)
If you want to know what it would do without it actually making any changes, you can force it to do a dry run by adding the /preview switch.
*1- make changes outside of Visual Studio
2- go to Visual Studio and open Source Control Explorer
3- right click on the folder > "Check Out for Edit" > "Check Out"
4- right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"*
I tested this workaround on a branch and it helped me a lot. But there are only new files and new folder who has to be done manually.
I recommend to create a branch before the operation. It isolates you the time of the operation.
Note: This technique does also the files identical cleanup that TFS always marks as modified.
Try this. It's some sort of workaround, but it works:
make changes outside of Visual Studio
go to Visual Studio and open Source Control Explorer
right click on the folder > "Check Out for Edit" > "Check Out"
right click on the same folder > "Undo Pending Changes..." > "Undo changes" > "No to All"
That's it. The changes are visible now.
There's also another solution to get TFS to figure out the files that have changed outside of Visual Studio:
Open the solution offline
In Solution Explorer select the solution file and then press the Go Online button ()
TFS will automatically scan the solution for changes after this.
Step one can be achieved in a number of different ways. Here are some:
Use the GoOffline Extension - very simple and effective.
If you're asked for TFS credentials when opening the solution (no automatic domain auth), then don't enter the credentials. The solution will open offline and you'll login after pressing the Go Online button
(extreme solution) Disconnect your network cable; Open the solution; Connect the network cable.
Visual Sourcesafe works like this too and the way I get VSS or TFS to notice the change is by checking the file out once inside Visual Studio.
Open Source Control and go to your TFS folder. Right-click on the folder and choose 'Compare'.
Notice that your edited files show up marked in red.
I find this is better than tfpt online which also gets you files that are not readonly and not edited.
I had this problem in the past, when my Internet was down and I worked offline, and most of my changes didn't appears in Team Explorer.
Following these steps:
First, In the solution explorer, select the folder that you want to re-conciliate (for me, it was my entire solution folder), and select Compare...
Click in Modify Filter, and in the filter text-box, you could type:
*.cs;!obj\;!bin\;!packages\;
In this example, it will include in the search only C# files and exclude in the folders: bin, obj and packages.
Notice the column Pending Change has the info whether the file is marked as edit, add, etc... or nothing...
To mark as edit (when the local item has a matching server item), select the file and choose Check out for Edit...
To mark as add (when the local item doesn't have any server item), select the file and choose Add Files
Finally, I am not sure why the projects are not listed here (after I remove *.cs filter, still doesn't show up), so rebuild the solution to make sure the projects updates as well
+ In the solution, click the connect button (if shows up) that said Go Online.
I found that in Visual Studio 2015, with the project open, Visual Studio discovered for itself that files had been modified externally, and automatically checked them out without me having to do anything. Checking in the project in the normal way saved the external modifications.
In my case, the following worked (at least the one time I tried it):
Go to the Pending Changes panel
Select View Options under either Included or Excluded changes.
Switch between Show All and Show Solution Changes
Switch back if desired
Changing the View Option appears to force a refresh of modified files.

How to add TFS bindings to a Visual Studio 2010 project?

There's a question already discussing how to add project/solution bindings to TFS, however it seems to only apply to Visual Studio 2008 (I am unable to find the "Change Source Control" dialog in VS2010).
I have a solution and source code on my local machine already in TFS, however it does not have TFS bindings (the thing that produces the padlock icon in the Visual Studio Solution Explorer and allows automatic checkout).
How can I add bindings to an existing TFS project using Visual Studio 2010?
In VS2010 check Tools>Options>Source Control and see if set to TFS. If not that might be why you don't see File->Source Control->Change Source Control.
I ran into this problem and, for me, the issue was that my solution was offline with respect to TFS. Upon trying to change source control, I received a message stating that it is already associated with source control but is offline. I placed the solution on-line, per my recollection, using the File->Source Control->Go Online menu option and this seemed to fix the problem.
Go to the source control explorer under Team Explorer, where you can see your repository. Right click on the top folder that maps to the folder on your local machine. There's an option called "Map to local folder". Map this to the folder on your local machine. This will set up all the bindings for TFS for your project.
I had the same problem and the following steps solved it for me in VS 2008.
Unfortunately, I didn't record the exact steps and don't want to add a new project to our TFS to try again, so the steps are from memory.
Go to File Menu -> Source Control -> Open from source control
Select solution file from TFS hierarchy
Accept any warning about project already being on local disc
A popup dialog comes up saying something along the lines "This solution is already under source control, but no bindings exist. Do you want to add them?"
A selector shows all projects in a grid and allows adding the required bindings. Add TFS server setting to each project (select all lines in grid at once and press a button at the top. I can't remember what it was called, but it was fairly obvious).

disconnect visual studio solution from sourcesafe?

I'm working on a project for a firm that has their main solution in sourcesafe. The other developers are working like beavers on new stuff, and I'd like to be able to download the source from VSS, then disconnect it. So I can get up to speed on the code without risk of bothering anyone else's code.
Is it possible to do this? Many thanks if so.
-Larry
It's been a while since the scary days of source safe, but i believe this is what you have to do. In Visual Studio, go to File -> Source Safe -> Change Source Control (?). It'll open up a new window and list projects under current solution bound to Source Safe. Select the project you want to remove and click 'Unbind' at the top. It'll remove source safe bindings from the project. If you have to bind again, just click 'Bind' and select the location in the repository to bind to.
From How to Remove Version Control Bindings from Visual Studio Solutions at devx.com:
Close all instances of Visual Studio, and delete all the files in the solution directory that end with .scc.
Edit the solution to remove all traces of the source code controller binding. Remove the section GlobalSection(SourceCodeControl) in the solution file. Also remove the keys named SccProjectName, SccLocalPath, SccAuxPath, and SccProvider.
Why don't you just make a branch?
To unbind the solution/Project from VSS:
In Visual Studio, open Solution Explorer and select a solution or project to unbind.
On the File menu, click Source Control, then Change Source Control.
In the Change Source Control dialog box, click Unbind.
Click OK.

Resources