TFS - checkout in wrong folder, folder deleted -> trouble - visual-studio-2010

I am experiencing trouble with the following:
In VS 2010, I followed these steps:
File -> Source control -> Open from source control
I selected a solution file from a project in TFS, and opened the project (obviously).
Unfortunately I opened the project in an incorrect folder, and I thought "If I delete the folder(s) and reopen the solution from TFS, everything will be fine". My bad!
TFS "reminds" that I checked out the project to this specific location, so now when I want to check it out again, the location box is greyed out.
Anybody got any clue how to fix this???
Thanks in advance!
Nico

Thanks for your answer Richard! Unfortunately this wasn't exactly what I needed, but I found the solution.
In Source Control Explorer, browse to the mapped source, right click and select "remove mappings".
Here you can edit the mappings to your local sources :)
Check out again and everything is in the right place!

There is a force option with get which will override TFS's knowledge odf the state of the workspace:
In Team Explorer use Get Specific Version: select latest as the version and tick "Overwrite all files ..."
With tf.exe use /force.

open source control. Go to the folder right click and select Add/ Edit Mapping whichever is available. This will prompt to download the new version. Do so and you will be good to go.

Related

The item is already under source control at selected location

How can I add a Visual Studio solution to the TFS? I created a new project named, for example, PROJECTX and I have solution with the name PROJECTX.sln. I select File > Source Control > Add Solution To Source Control, but immediately I get this error:
I also deleted and recreated the same project in TFS and my solution does not have any .vssscc files, therefore I think it wasn't in TFS before, maybe some other copy... but when I deleted the project in TFS, it should not matter, right? I tried the bind/unbind option, but it seems that I'm missing something important. Also I don't have any pending changes and the TFS project is empty on the TFS server.
If I select the Ignore All option, I cant check in the files, because it tells me it is already checked in.
On my case, I had to correct the binding using the Change Source Control dialog box :
Select solution or project that you want to add to source control
Go to "File" -> "Source Control" -> "Advanced" -> "Change source control" (if you look at Microsoft website, you will see that there is not "Advanced" menu in their example, it may be related to VS version or menu settings).
Click "Bind" on each row.
If a row in underlined in red, it may indicate that the current project is not checked in into TFS, check-in all project before you proceed to the binding.
Microsoft - How to : Bind and Unbind Projects and Solutions
Close the solution .
open the solution file in notepad
Then remove the below section.
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {3CF58AB4-18FA-4F8D-95D4-32DDF27D189R}
SccTeamFoundationServer = https://serverIP/Project
SccLocalPath0 = .
SccProjectUniqueName1 = Ecample\\Example.csproj
SccProjectName1 = Example
SccLocalPath1 = Example
EndGlobalSection
then open the solution once again it should prompt to bind, do the binding properly.
I solved this issue by copying the project folder to the new windows folder outside of local tfs workspace.
I had the same. I first created a new folder in TFS, then in File Manager, copy the whole project w/o .sln file to this folder (TFS already created in file system), back in TFS, clicked on "+" icon to add everything underneath this new folder.
Then checked in for the first time.
Continued working on the project made some changes. I thought it's okay to "Add Solution to TFS", still the same problem, even though removing all .vss files/folders.
Since I know TFS already has a copy, so I "Compare" it with my local version see the difference there.
So I just clicked on "Ignore All" button, Bingo, works.
This is how you need to bind the solution to the server
I followed these steps:
If you're already in Visual Studio with the solution opened, close the solution via: File > Close solution.
In Source Control Explorer window, in "Folder" section (left side of the screen), navigate between your TFS projects, find and open the solution you want.
You'll get a message saying:
The solution you are opening is bound to the source control on the
following Team Foundation Server: your_server_folder.
Would you like to contact this server to try to enable source control integration?
Press Yes and if the connection is correct, you'll see now your solution is bind to source control.

TFS not adding files to repository properly

We are working with building ETL packages in SSIS using a TFS repository. When my collegue add new files to the repository they are not added properly to the repository even though he checks in the entire project file. He sees the files in his project folder, and it looks like everything is checked in. But when I click on "Get latest version" I get a warning that the package is missing from the project directory. If any of us then try to add the file again we get a warning that the file all redy exists, even though it is not visible in my folders. Right now the solution we are using is for him to delete the file and then commit the change. After he deletes the file I get the latest version. Then he sends me the files and then I add them to the repository. Once I have added the files things seem to work as expected. Has anyone else had this problem, and know of a solution?
UPDATE:
The solution we found now is that I have to go to the local folder and find the new file my colegue added. Then I right click the file he just added and select add to project. Then the new file is visible in my version, but it does not have a blue lock icon next to it. If I then double click the sln-file to reload the project the blue lock icon is visible to me.
It is still not an optimal solution, but it works a lot better than him having to send me the file so I could check it in.
Is this the way TFS is supposed to work?
Can you please check the mapped work space path in your local machine there you will find the checked code. You need to manually Add.
Right Click on SSIS package -->AddExisting Package--> Select the package from Workspace-->Ok
Now you will find the missing package in your Solution Explorer as well.
If you are using TFVC.
Open Source Control Explorer=>Right click that solution/project folder=>View History, then check the related ChangeSet whether he add the file correctly.
Let your college to check the permission of that folder/file: Right click the folder/file->Advanced=>Security.
Regards

How do I get my solution in Visual Studio back online in TFS?

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'.

The project file has been moved renamed or is not on your computer

I get this error when I try to load a VS 2008 project from TFS source control:
The project file has been moved, renamed or is not on your computer
After I click OK the project says "unavailable".
What is the problem? How do I resolve this? I never had this problem before. Some blogs said to delete the .suo file but I can't locate the .suo file. I deleted the entire project on my local computer so that the next time it opens it will create a new one, but I still get same error.
What typically helps to fix it is deleting the Solution User Options aka "SUO".
VS up to 2013
In the older VS it is stored as a "hidden" SolutionName.suo in the same folder as the main .sln file.
VS2015 or later
In VS2015 the same data was moved to a "hidden" .vs folder under the same folder as the main .sln file.
I just ran into this issue using VS 2013 after renaming a project. Stanley's answer guided me to the solution:
Close VS - delete .suo file - start VS again.
Delete the .suo file in a special way.
Don't have the solution open when you delete the hidden .suo file.
Restart VisualStudio.
Open solution and Add project without error message.
TFS works like most source control packages: It remembers what it has put on your computer so that when you "Get Latest" it only has to get the chnages since your last "Get" instead of having to get absolutely everything.
This has one caveat: If you delete or rename the local files on your disk, TFS won't know that you have done this, and it will still think they are where it left them.
If you then "Get Latest" it will not bother to update the missing files.
You are then likely to get all kinds of "missing file" errors, from TFS and any other tools that look for the files.
To get around it, you need to:
If you think you might have any changes in there that you don't want to lose, copy the source folder on your PC as a back up just in case!
Right click on the project (in Solution Explorer) or folder (in Source Control)
Choose "Get Specific Version" from the context menu
Choose to get the "Latest Version" and tick the option that says (something like) "force get of files already in your workspace", which tells TFS to forget about what it "knows" and get all the files again anyway.
If you have any locally-changed (writable) files, then be careful. There is a second option that will overwrite these, losing your changes. But you have the backup, so you should be safe. It's generally better to tick this option as well to make sure that all your source code is completely up to date. (But obviously only if you don't mind losing any local changes!)
When you OK, this will forcibly get all the files in the project to your local drive, and should correct the problem.
Easiest option worked out for me is:
Right click the project & Remove the "not loaded" or "unavailable" project
Right click the solution & Add "Existing Project"
Though it's well known VS defect, definately we can handle it!
Open the solution file in edit mode
Modify the relative path to match the modified/moved physical path ..
SccProjectUniqueName1 = Source\\Order\\Order.csproj
SccProjectName1 = Order.ApplicationService
SccLocalPath1 = Order.ApplicationService
Also, makesure of correct relative path for the referring project(s)
Project("{asdasd-301F-11D3-BF4B-asdasd}") = "Order",
"Source\Order\Order.csproj", "{E25641BC-C990-40E2-8876-08AE8728F763}"
EndProject
Try opening the .csproj or .vbproj instead of the .sln. What has probably happened is the .sln (solution) file has a absolute file reference (instead of a relative path) to the compoenent project(s). You may need to re-create the .sln, or hand-edit it.
In my case, deleting the .suo file was insufficient. I discovered that my workspace configuration had an error. I discovered and resolved the problem with these steps:
In Team Explorer, "Manage Workspaces..."
Click "Edit..."
Correct the value under "Local Folder"
Finally, delete the affected .suo files per the accepted answer.
I found it easiest to create a new Solution sln file.
Clear out your workspace mappings (File -> Source Control -> Workspaces). Edit the workspace and either clear out all the mappings (more repercussion) or find the one that's associated to this server path. Then open Source Control Explorer and remap. Double click the SLN in Source Control explorer and it should get latest. Not entirely sure what has happened or what state you managed to get into, but with this should get you moving again.
I ran into this issue and was able to resolve it by obtaining the .rptproj files from a co-worker and copying them into my local directory. The project was then able to re-load.
I spent a lot of time for trying solve this problem. I did these steps : rename project, rename namespaces, rename project folder, edit .sln file, edit hidden .suo file. Project loaded but it was unrecognizable for TFS! Finally I found this guide.
If you're using Resharper and TFVC is your version control, follow these steps :
Right-click the project in Solution Explorer, select Rename, and enter the new name
Right-click the project again and select Properties. Change the "Assembly name" and "Default namespace" on the Application tab.
Right-click the project again and select Refactor -> Adjust Namespaces. Accept the changes.
Change the AssemblyTitle and AssemblyProduct in Properties/AssemblyInfo.cs
Delete bin and obj directories in Windows Explorer
Open the Source Control Explorer and rename the project's directory. This will close the solution. Let it be closed.
Open the SLN file (with a text editor such as Notepad++) and change the path to the project (there should be multiple places).
Open the Solution again. Clean and Rebuild the project.
Right click on the unavailable project and edit the project file ... chances are, you will find a hardcoded file path or a virtual one that does not match where you checked the project out to.
Kindness,
Dan
Solution for this
Again rename the project folder
Set specific version & force get in TFS
remove read only & hidden option in the latest folder (not the rename one)
Now you can open the project without any issues
Sometimes, even though you changed .sln and .csproj path, and manually rename, you might forget to check the folder name that contains the project.
It happened to me too. Apparently the csproj files were not checked in when I had created them in my old computer, and so when I downloaded the project from TFS in my new computer, the files were not there.
After checking them in using my old computer and getting them from TFS in the new computer, I succeeded in reloading the project.
In my case, because I modified .csproj file, it changed to .csproj.user .
I remove .user from the end of the file.

Adding a new project to an existing solution in TFS

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.

Resources