Why are all files write protected and how can I check-in? - tfs

I currently work with a Team Foundation Server and Visual Studio. Since two days, I keep getting error messages that I can't write to files (it seems not to matter which file I try to access). I am the only one in my team who has those problems.
So when I try to check-in, I get:
When I click on Overwrite, I can overwrite it. But when I try to check-in pending changes, I don't see any changes. If I modify a source file, I can compare it to the latest version and see that there are changes.
How can I fix this? I simply would like to work ...
Work-around: If I "Check Out for Edit..." the file (so I get the lock) I can edit it. But this doesn't work for the solution file, because somebody else checked it out.

Go to Solution Explorer
Right click on your solution
Click Go online

It seems that your solution is not connected to the Team Foundation Server.
I would recommened that you remove the mapping of your workspace, delete all local files of the workspace and then get a fresh version (Get latest version) from the Team Foundation Server.
To remove mapping you need to open the Source Control Explorer in Visual Studio. Navigate to the Branch you are working on and open the Context Menu (right click on branch). In the menu you select Advanced->Remove mappings....
In the dialog you can edit or remove the mapping of your workspace. (Note: When you select Remove mapping then will all files in the Local Folder be removed that are controlled by TFS)
What you also can do is to check the state of your workspace/solution if it is connected to TFS. To do that you need to open the solution in Visual Studio and then open File->SourceControl->Advanced->Change Source Control... in the File Menu of Visual Studio.
In the Dialog you will see if your Solution and projects are connected to TFS and the server they are connected to

You should have the correspondings local files like in the source control.
Go to the local file, right click on it and choose Properties,
in the opened dialog uncheck the read-only checkbox, click Yes to the question if you want to apply changes to all subfolders and files.
Hope this is helpful.

You will face the same problem when setting your Workspace location to server (which in my case happened somehow magically).
To change the location to local again open the source control explorer and in the upper part you find a drop down labeled "Workspace". From this drop down choose "Workspaces...". This opens the "Manage Workspaces" dialog where you can select your workspace and click the "Edit" button. In the Edit dialog click the "Advanced" button and you'll see a drop down for Location where you can change it to Local again.
MSDN provides detailed information on the pros and cons of local and server workspaces.

Related

TFVC pending changes without checkout in TFS Everywhere

Using TFS everywhere. Editing files without "checkout for edit".
after it, unable to see edited files list in "TFVC pending changes" window.
Try to see if your project is Offline, that is the behavior when your project is not connected with the TFS.
1- Right-click on the solution name right at the top of the Solution Explorer and select the Go Online option
2- If that doens't help, please check your connections to the tfs through the Team Menu -> Manage Connections.
3- If still happens, try to restart the Visual Studio
You are using Team explorer everywhere. Try to check whether your project is offline:
Right click your project > Team > Return Online.
BTW, the project will be offline if you switch workspace to other that isn’t include that project.
Update:
Pending changes window > Click Actions > Detect Local Changes, then the modified file (tracked by source control) in current workspace will be included in Included Changes

Project not showing as checked-in to TFS in Visual Studio 2013

I added a new project to a Solution Folder in VS2013. I added the project to TFS via Source Control Explorer but in VS Solution Explorer the little lock icon next to the project is not displayed. I just downloaded the solution to a new computer, and that project did not get downloaded. I had to go into Source Control Explorer and explicitly get it. The solution just does not recognize it as under source control...
How do I correct this?
Any help is appreciated
You probably need to bind the project to source control.
Open the project in Visual Studio.
File > Source Control > Advanced > Change Source Control (or you might find there is only an option like File > Source Control > Add to Source Control - I can't remember exactly what this looks like)
If you get to the Change Source Control dialog, then select all the projects in the list and click Bind. If this works you should have a tick in the "Connected" column and "Valid" status, and you can OK the dialog and your project should be good to go. If binding fails, then Unbind everything and try binding again.
Looking back to basics, I discovered some of the files (such as the project file itself) had never been added to source control. I discovered this by going to Source Control Explorer, selecting one of the projects unmarked in Solution Explorer, right-clicking to get the context menu, then selecting Add Files To Source Control, then selecting the whole list presented, then clicking OK/NEXT/FINISH. That marked the unmarked project in Solution Explorer with a plus sign (+) to be added. Then again from Source Control Explorer I selected the solution and clicked Check In Pending Changes. Then I got the lock icon in Solution Explorer.
If the Projects/Folders are missing in Source Control this can be done -
Open TFS -> Source Control Explorer -> Right click on Solution folder and click 'Add Items to Folder...'. Now in 'Add to source Control' prompt select the folder of desired project that needs to be added to source control. On doing so the project folder along with its content should appear with + sign and on check-in the project will be available under the solution in source control.
This is the reason due to solution is available on TFS but local instance is not bound to server directory.
Solution:
Files=>Source Control=>Advanced=>Change Source Control
Then Bind all projects to server repository location.
This will resolve the issue.
Compare with another correct project,I know it's lost xxxx.csproj.vspscc file for my project.
for init this file.
First , you should open right project and add error project in current solution.
Then,Right click error project click Source Contorl → Add Item to source control
Then, source control will warn you
Click Continue
Source control warns you again to rebind item
you shoud click Ignore All
After check out and check in error project,It will be ok.

Force TFS to detect changes

Seems like this should be something very simple, but I can't find how to do this...
I made a changes to several files spread within a repo by using a script that I wrote. Problem is TFS in its infinite wisdom does not think the files have changed. Aside from manually finding each file and clicking "checkout for editing" is there any way to tell TFS to just rescan everything and detect changes?
A Folder Compare (File->Source Control->Compare...) should do the trick. Select the top folder from where to start comparison, and select to compare with Latest Version. The result hould show files that are changed, and whether they are checked out or not.
TFS has a "Reconcile" command for this. See https://stackoverflow.com/a/22860674/932282 for a complete answer.
Local Workspace
You need to work with a local Workspace. Here's how to manage workspaces:
visualstudio.com: "Create and work with workspaces".
When adding or editing the workspace you click Advanced >> . Then you set Location: to Local.
Now when your script or anything else changes files outside Visual Studio, your workspace detects the changes automatically.
It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under Excluded Changes
BUT BE CAREFUL. When adds or deletes get detected and you add them to your Pending Changes, the files aren't automatically included to your project. So you maybe check them in to TFS, but they aren't listed under the Solution Explorer.
Matt Burke has a fix for that problem:
mattburkdev.com: "Automatically Include All Files in Folder in Visual Studio"
To edit the Project file you rightclick your project, chosse Unload Project, then rightclick on it again and choose Edit. After you edited the project files save and close it. Then rightclick and chose Load Project.
But with that you also need to be careful, because the Project only searches for new files in these folders to include, when you load the project and not while you have the project open. So when some files get added outside Visual Studio, you just reload the project.
Server Workspace
But if you have to stick to a Server Workspace for some reason i got another trick for you:
FIRST:
Check out all Files that maybe have pending changes (better check out many files). Then go to Team Explorer -> Pending Changes and choose all files you just checked out. Then choose "undo changes". After this you get a message "Confirm Undo Checkout". This message ONLY pops up for the files, which actually HAVE changed! Press "NO" for each files or "No to All".
FINALLY: Under pending changes all files get removed from the list except the ones which have pending changes.
I hope I could help someone and you didn't have to search for this solution as long as I had to ^^
If any of your changes occured when you were offline, you can go to File > Source Control > Go Online, and all files will be checked for modification.
If none of the above work, you can also try to rebind your projects by going to File -> Source Control -> Advanced -> Change Source Control.
In Visual Studio 2015:
Source Control -> Advances -> Refresh Status
I had this problem a while age when i moved project from one pc to another.
the solution was to remove temporary files that TFS had created in solution folder.
Delete .vs and hidden $tf folder.
If no luck,on your local PC copy your solution folder to another, remove all files inside solution, get latest version from TFS server ,then from the copied folder just grab neccessary and edited files and put them back to solution folder (this will overwrite some files).
After all don't forget to check project mappings and if everything seems correct try right clicking on solution and 'Add to source control' option.
Dtsx file dropped in TFS folder was not being recognized.
On your Visual Studio (2015) home screen, click on the Team Foundation Server link. Make navigate to the correct branch.
On the window on the left side of the screen, navigate to the folder that contains your file. Expand the folder.
To the right of the folder you will see three dots. Click on those and then click on “ + Add File(s)”.
Choose “Upload Existing Files”. Then you can drag and drop your .dtsx files into the window and then click Okay.
Finally, you’ll have to do a ‘Fetch’ to add the files there. Then you need to do a ‘Pull’. Lastly, you can commit the change to remote branch.

How to undo changes in tfs coming from unmanaged workspace?

I have a workspace that is lost forever. I have some files checked out from this workspace. I want to unlock them but I can't. I tried to do:
TF UNDO $/MyProject/MyFolder/MyFile.cs /WORKSPACE:LOST;user /s:http://mysite:8080
But I got this message:
The workspace LOST;user is not on this
computer. Run get (get all if edits
were undone) on the computer hosting
that workspace to update it with the
change s that have been made on the
server.
Does exist any way to undo a file (not every file) checked out by unavailable workspace?
If the workspace is lost, then I would just delete it. Deleting it undoes any changes that were made in it.
tf workspace /delete WorkspaceName;WorkspaceOwner
As long as you have the appropiate permissions I would think that the method from this answer by #BubbleSort should work: https://stackoverflow.com/a/17870318/1982894
He used TFS 2012, I have tested it in TFS 2010 and it works there too.
Answer copied for easy reference:
(Note: I have the TFS Power Tools installed so if you don't see the
described options you may need to install them.
http://visualstudiogallery.msdn.microsoft.com/b1ef7eb2-e084-4cb8-9bc7-06c3bad9148f
)
If you are accessing the Source Control Explorer as a team project
administrator (or at least someone with the "Undo other users'
changes" access right) you can do the following in Visual Studio 2012
to clear a lock and checkout.
From the Source Control Explorer find the folder containing the locked file(s).
Right-click and select Find then Find by Status...
The "Find in Source Control" window appears
Click the Find button
A "Find in Source Control" tab should appear showing the file(s) that are checked out
Right click the file you want to unlock
Select Undo... from the context menu
A confirmation dialog appears. Click the Yes button.
The file should disappear from the "Find in Source Control" window.
The file is now unlocked.

How do I change my workspace in Team Foundation Server 2005 and 2008?

I have multiple projects in a couple of different workspaces. However, it seems like I can never figure out how to change my current workspace. The result is that files that I have checked out on my machine are shown to be checked out by somebody else and are not accessible.
I'm going to assume you mean "workspace", not "workstation", as your question doesn't quite make sense to me otherwise.
In Visual Studio, go to the Source Control Explorer (View->Other Windows->Source Control Explorer). At the top of the source control explorer window you should have a toolbar with a few buttons. Somewhere on that toolbar (for me it's at the right) there should be a Workspace dropdown. Just select the workspace you want to use from that dropdown.
Are you wanting to change the location of the files on the workstation? If so, here's how I do it:
Open Visual Studio
Open the Source Control Explorer window.
From the Workspace dropdown select "Workspaces..."
The Manage Workspaces dialog should show up.
Select the workspace you want to modify, and click Edit...
You should be able to adjust the folders from here.
First, you should active you workspace window.
choose the window menu
click Source Control Explore.
click Active button.
The Workspace window appears
click the WorkSpace name in Workspace window.
from the popup list choose the Workspace name you want.
In Visual Studio 2013
If you just regret which local folder you choose for a project under version control. Do like follows:
In the Source Control Explorer in the Folders pane
Select the project which local folder destination/mapping you are not pleased with.
Right click. --> Advanced --> Remove mapping.
A window opens: Press the browse button and choose another local folder for the project and then click "Change".
Click on: File -> Source Control -> Advanced -> Workspace and then you can edit or remove the existing mapped locations
I don't entirely understand your question.
Are you saying that files you check out on one machine seems to be unaccessible on another of your machines? I'd say that would be entirely by design, as now you have a file that has local modifications done on one machine, which may or may not be available on your other machines.
When you say checked out by somebody else, what does that mean exactly? How are you verifying this, what are you looking at?
Or do you mean something else? In that case, please elaborate.

Resources