How to Unlock Newly Created Folder in TFS - tfs

I am using TFS 2010 in my project,and have added some Existing Projects in my solution and i have shelved the changes(all the added files are checked out). When my team member unshelved the changes they got error like
Info.cs locked for Check out by username in workspacename
this continues for all my newly added files.
is this permission problem,because when i Right click the newly added folder, Unlock,Lock,Properties options are disabled.
I want to remove the lock and my team member also to be able to unshelve and checked in.
Can anyone please help to unlock the files.

You can use the command line http://msdn.microsoft.com/en-us/library/c72skhw4.aspx, or you can use the Sidekicks for this http://www.attrice.info/cm/tfs/

Related

What Happens to Local Changes When an Admin Forces Unlock a Specific File?

I'm using Visual Studio 2015 and TFS source control.
Imagine i checked out a file and added a line of code and leaved the office without checking in. Someone else needed to make a change in this specific file but cannot check out because it is locked on me. An admin used TFS command line tools or something else and undoed my lock on this file to allow the second person to make the changes.
The question is that in this case, what happens to the file in my computer? Is the line i added deleted or still there but i cannot check in since the lock has been undoed and i need to get latest version and add the line again?
Thanks,
A check-out lock prevents users who are using server workspace from checking out and making changes to the locked item in their workspaces. In Team Foundation Server 2012 and later, check-out locks are generally not effective because of local workspace.
Assuming you are using server workspace, for your scenario, the file on your computer won't be changed. When you want to open the file on your computer, you'll get the following item to let you choose server version or workspace version.

Undo TFVC check-out for deleted user

I am attempting to undo pending changes for a user that no longer exists in our organization. DevOps will not allow me to work with the workspace or identity at all, indicating the user is not a valid identity:
TF14045: The identity XXXXXXXX, XXX is not a recognized identity.
We don't care about any pending changes, we just want the (shared) locks removed.
Can this be done? Thanks all.
When you run commands to work with the workspace, try using their email address instead of their display name. For example, list that user's workspace with the command below:
tf vc workspaces /collection:https://xxx.visualstudio.com /owner:<email>
Then run tf workspace /delete to delete the workspace.
First make sure you have the rights to unlock others code see here: https://learn.microsoft.com/en-us/azure/devops/organizations/security/permissions?view=azure-devops&tabs=preview-page#tfvc-object-level
Then you should be able to use the TF command to unlock files. See here: https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/lock-command?view=azure-devops
(You'll want to use /lock:none to remove the lock)
I'm also pretty sure that if you delete the workspace of the user that left he lock will be removed, check it out here: https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/workspace-command?view=azure-devops
From this article: "If you delete a workspace that contains pending changes, Team Foundation cancels the pending changes as part of the delete process. Deleting a workspace does not delete the files and folders on the client computer that were in that workspace."
Good luck

TFS checkin error - could not find file

When checking in my project I get the error:
Could not find file 'C\blah blah blah'.
I have a feeling this might be a file from an old project I deleted.
I have tried deleting my TFS connection and workspaces.
This will happen when TFS has some changes staged that no longer exist on the file system. For instance, if you add some files in Visual Studio (which adds them to the changes list), delete them directly from the file system, then attempt to check in the changes, it will complain that it could not find the file(s).
To remove these changes from the list, you can open Source Control Explorer (View > Other Windows > Source Control Explorer) and either Delete the nonexistent files or right-click on the offending files and Undo Pending Changes.
You can also undo these specific changes from the Pending Changes panel in Team Explorer.
Create an empty file to replace the missing file and complete your check-in. After you have checked in the file correctly delete the file that is not needed.
Go to the project that has file 'blah blah blah', you should see the file has an error mark indicating it does not exist. Right click the file > Delete. That should take care of the problem.
I had a similar problem. I had forgotten I was tinkering with adding publish profiles for publish. TFS felt it needed to check that in, even though the output wasn't there. I simply right clicked on the App.Publish folder in Team Explorer inside of visual studio and chose to exclude. Checked everything back in with no problem.
I encountered the same error:
but my issue was a bit different. I was changing a couple of folder names and when committing I didn't add the new folders to the repo:
git add folderName
solved the issue for me.

TFS 2010: How to check in files that were deleted but not deleted through TFS

I have some files in a local workspace that were checked out and then deleted but were not deleted through TFS. TFS still has them marked as "edit" in the pending changes view. When I try to check-in the deleted files, I get an error saying the files cannot be found. Is there a way to tell TFS that these files have been deleted and that they should be deleted in source control as well?
You could, through team explorer, right click on the deleted files and do a undo pending changes. Then through team explorer delete them and check them in.
If that doesn't work - right click on the deleted file through team explorer; do a get specific version and check both checkboxes to overwrite files:
This will fetch the deleted [from workspace] file from TFS. Perform an undo pending changes on the file. Then delete the file through team explorer and check it in.
If there aren't too many files, just create some dummy ones on disk, check them in, then delete them through TFS.
I think you should be able to do this via source control explorer: View -> Other Windows -> Source Control Exlorer. Find the code file that you want to mark as deleted and right-click and select delete.
For future reference, TFS Power Tools is very useful for this kind of thing.

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.

Resources