I have a 2013 Visual Studio Web Project which was in source control. It has been detached for some time and now I want to move it to a completely new TFS server but when I do it errors and complains expecting certain folders to exist. I think this is due to the TFS bindings.
Now I have seen lots of posts about how to edit the solution file to remove the bindings, plus a few other steps but I'm wondering if there is a menu item which you can click to remove the bindings so I can point at a different TFS server? I am hoping I don't need to edit solution file.
I am not simply being lazy - but I want a defacto way of doing this correctly in one go, not hack here and hack there. Hacking a solution file from someone's advice is not the same as clicking a 'Microsoft' menu item.
Quite easy, you just need to follow my steps and you will get it worked.
Open your solution, for now its under source control with your old
TFS server.
Move to File -> Source Control -> Change Source Control , on the
pop-up window click the unbind, you can unbind all of the
solution or a specific project. Will get a below screenshot.
You can check the solution in solution explorer, there is no lock
icon which means not in source control any more.
However, this isn't over. Since your solution file is still in the
workspace which associate with the old TFS server. So if you want to
add the solution to new source control right now, you will get an
error:
" The item 'ConsoleApplication1.sln' is already under source control
at the selected location xxx"....
You have to copy this solution to a different place out of your
workspace. And change the connection of TFS to the new TFS
server(which you want to add source control with).
Finally, open the solution from local folder(new copied). Right
click the solution in solution explorer select "Add solution to
source control" and choose the location you want add to.
Related
As per the tags, I'm using VS2013 and TFS2013.
There are multiple projects in the solution: Model, Presenter, View, etc. All other projects are working as expected in terms of source control operations.
Problems with the Model project:
Adding a new file via Solution Explorer isn't automatically detected as a pending change
Deleting a file isn't detected either
Other source control operations work fine for the Model project, such as:
Get latest version
Edit detection for existing files (including changes to the csproj
file when a new file is added)
Checking in pending changes
The csproj file would show up in pending changes with the newly added file listed in it, but the new file itself isn't showing up, therefore causing build errors on other developers' machines if only the csproj changes are checked in.
The workaround is to find the added file in solution explorer and Add via context menu, this will make it appear as a pending change. But this process should be automatic as per the other projects.
Noticed that there is no .vspscc file for the Model project while other projects have one each.
Any help appreciated. Thanks.
I would unbind and rebind the problem project and try again:
To unbind a solution or project from source control
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.
To bind a solution or project to source control
In Visual Studio, open Solution Explorer and select a solution or project to bind.
On the File menu, click Source Control, then Change Source Control.
In the Change Source Control dialog box, click Bind.
Select the database and location to which to bind, and click OK.
Click OK.
You might need to go to Advanced to find the Change Source Control option
https://msdn.microsoft.com/en-us/library/0eh3790h%28v=vs.90%29.aspx
Before unbinding and binding your solution try his:
Go to Source Control Explorer
Click the "Add Items to Folder" (the
one on the left of the red cross)
Select the items you want to Add and follow the instructions on screen
That's all
Click <Detected: x add(s), x delete(s)> : in the source control explorer then select the file to add
For years I've been relying on 'Detected Adds' to add missing files - which was never a sustainable solution but I've just about managed with it.
But now if broke.
I'm actually about to reinstall Windows but in the meantime one of the best ways I've found to get a sense on what's missing (and it's still working even though the detected adds isn't) is the recursive 'Compare' window.
You can add files from here too.
It's a little klunky but it gives me a good sense of security and shows file diffs if you want to see what may have changes.
I had my solution in Visual Studio 2012 (which is under TFS source control) open and the TFS server (2010) was down. When I then made a change to one of the files and attempted to save it I got a prompt to ask whether I wanted to Overwrite the file saying the TFS server was down (can't remember the exact words) and the following message appeared in the Output window:
This solution is offline. [Team Foundation Server: http://tfs1:8080/tfs/server]
The solution was offline during its previous session and will remain offline.
How do I get the file change to be recognised as being among Pending Changes and the whole solution back online?
I searched for the solution online and found this solution but wasn't too keen on the registry change.
I found a better way: right-click on the solution name right at the top of the Solution Explorer and select the Go Online option. Clicking this allowed me to select the files that had been changed when I was offline and make the solution online again.
After finding the solution, I found the following msdn forum thread which confirmed the above.
Go to File > Source Control > Go Online, select the files you changed, and finish the process.
Rename the solution's corresponding .SUO file. The SUO file contains the TFS status (online/offline), amongst a host of other goodies.
Do this only if the "right-click on the solution name right at the top of the Solution Explorer and select the Go Online option" fails (because e.g. you installed VS2015 preview).
(Additional step from solution above for if you are missing the AutoReconnect or Offline registry value)
For Visual Studio 2015, Version 14
Turn off all VS instances
HKEY_CURRENT_USER\SOFTWARE\Microsoft\VisualStudio\14.0\TeamFoundation\Instances{YourServerName}\Collections{TheCollectionName} (To get to this directory on Windows, hit the Windows + R key and search for "regedit")
Set both the Offline and AutoReconnect values to 0.
If you are missing one of those attributes (in my case I was missing AutoReconnect), right click and and create a new DWORD(32-bit) value with the desired missing name, AutoReconnect or Offline.
Again, make sure both values are set to zero.
Restart your solution
Additional info:
blog MSDN - When and how does my solution go offline?
I am using Visual Studio 2017 15.4.0 version. Especially when i started use lightweight solution option, this offline thing happened to me. I tried to above solutions which are:
Tried to regedit option but can not see appropriate menu options. Didn't work.
Right click on solution, there is go online option and
when i choose it that gives this error message: "The solution is
offline because its associated Team Foundation Server is offline.
Unable to determine the workspace for this solution."
Then from File -> Source Control -> Advanced -> Change Source Control. I saw my files. I select them and then chose bind option. That worked for me.
You can go use registry editor.
Turn off all VS instances.
Open registry editor and go to:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances
Find proper server e.g: team32system1
Go to Collection and nex DefaultCollection:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\TeamFoundation\Instances\team32system1\Collections\DefaultCollection
Set Offline key to 0
Open solution in VS. Afterwards pop up should appear which question would you like bring solution to online mode.
Neither of the above solutions worked for me on Visual Studio Community 2017 v15.7.1. Somehow, there was no "Go Online" option in the context menu. I tried registry edit as suggested here, but that only displayed me error that it could not find the binding. What worked for me is rebinding solution to the server from Change Source Control menu.
Go to File->Source Control->Advanced->Change Source Control and make sure that your solution is binded to your source control. If not (like mine) then click on bind button, it will automatically search online TFS server and rebind your solution to it.
i found another way without much effort.
Just simply right click your solution and then click undo pending changes.
Next, VS will ask you for acutally changed file where you want to undo or not specific file.
In this you can click no for such a file where actual change is happende, rest is just undoing. This will not lost your actual changes
You will need to do two steps here for a complete solution
First click on the Solution that you have open and then go File-> Source Control -> Go Online Then uncheck all the files that are being shown as being modified while you were offline.
Don't do the Get Latest version from Source Control Explorer. That will result in a dialog potentially showing a bunch of files asking you to resolve conflicts. Instead do this
In source Control explorer right click on the folder you want to get latest of and then Advanced - Get Specific Version. In the dropdown for version type choose Latest and then choose the first check box that says Overwrite writable files that are not checked out. This will automatically bring your folder in sync with latest on the server
One method I did with mine, is to "Add to Source Control", and select 'Git'.
I started a new project and decided to add it to source control (TFS). When I right-click on the solution and choose Add Solution to Source Control Visual Studio automatically adds it to the top level directory of source control without prompting me on where to put it. The solution has not been checked in yet.
I think what happened was the first time I tried this it asked me where I wanted to add the solution but I didn't select the correct spot. Now when I undo pending changes and try again it always puts it in the same spot without asking.
Is there a way to start over?
From the visual studio toolbar | file | source control | workspace |
open the workspace you are using and remove the extra binding that got added because you prviously added the solution to source control.
Once you added your solution to the source control, TFS memorizes the mapping of the location to the local path. To remove the mapping, open the Source Control Explorer window, right-click on the solution and choose "Remove Mapping".
You also may find this helpful: http://zayko.net/post/How-to-permanently-remove-TFS-Source-Control-association-bindings.aspx
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.
I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next to them. What did I do wrong? How do I fix it? It's time to check in.
The problem is the solution has lost its binding. That's why it's not checking out automatically when you add the new project.
In order to restore the binding in VS 2010, go to File->Source Control->Change Source Control. Look for the "Solution: your solution name" and if it's not bound it will say "no server". Click on it and then click "Bind" from the toolbar.
in Visual Studio 2012/2013 it's File->Source Control->Advanced->Change Source Control (Thanks to danglund).
This should create a new vssscc file that is correctly bound. Now add the new project and everything should work correctly.
I was also having the same problem, this is how I fixed it:
Go to Visual Studion: File->Source Control->Change Source Control
Find your project there, its status would be "Invalid", Click on it and press "Unbind". Now go back to Solution Explorer and Remove your project. Add this project again into the solution explorer solve the problem.
Good Luck!
Click on the Team Project name in Source Control Explorer
File -> Source Control -> Add Items to Folder...
Follow the wizard.
Head over to Source Control Explorer and browse to the place in the tree which matches where the new project is at for your solution. Add the files there.
However, I'd be concerned that you modified the solution file and it didn't ask you to check that out. What you may want to try doing is manually checking out the solution file, then readding the project to the solution and seeing if it takes then.
You shouldn't need to drop to the command line - this is a pretty straightforward operation.
Open the solution. Select the project (make sure it is in the solution).
File -> Source Control -> Properties will bring up the binding dialog.
Bind the project to source control.
You should now see + signs next to all your files. The key is that that a .vssscc is added for your project to version control.
If that fails, open your csproj in notepad (after making a backup), and ensure any version control bindings are removed, then try again.
Unfortunately, I'd wager that your best bet is to manually do the check-ins through the command line. I've ran into situations where the Team Explorer UI grows out of sync with what's actually happening in source control, and manually fixing things through tf.exe was the only way to resolve it.
That said, normally, adding a new project to a solution isn't a hassle.
TFS can simply do not know about your project existed. Just add your project files through Source Control Explorer and re-load the solution.
While loading of a solution it can ask you to bind your project to source control. Let it do so by clicking Bind button - it should do all the magic for you.
Make sure you get the latest version of the solution
Check out the solution file
Add the new project
If the newly added project was previously under (another) source control, that might mess things up, make sure to "unbind" it before adding it. (See source control bindings somewhere under the "file" menu in Visual Studio)
You shouldn't need the command line.
I had this same problem in VS 2019, where I had added a new project to an existing solution, and the project wasn't showing up in pending changes. Right-clicking on the project and going to Source Control only had an option to "Add Solution to Source Control".
Using the above answers, I started down the File --> Source Control path, which then yielded an option to directly "Add selected projects to source control". Taking that option solved the problem, so that now the new project shows up in pending changes. NOTE: I'm adding this answer since it's still an issue in VS 2019, but has an easier solution now than in the past.