How to check in (or upload) again a solution that i have on my local drive and manually deleted from TFS? - c#

I'm using VS2017 and i have a solution on my local drive.
I had the same solution on my TFS as well, but i deleted it from the repository page manually.
Now if i want to check in the solution again i get a 'no pending changes' message, even if the TFS folder is empty.
I tried a few things but nothing seems to work.
I just don't know how to put these files on my TFS again and i can't find the help i need anywhere. Sorry if it's a duplicated question, i just can't find the answer to this.

Assuming you are using TFVC;
You need to sync (get latest) your local workplace with the server to see any further changes.
If you want to simply "restore" the solution, you can do an "undelete" through the source control explorer.
If do not want to revert your delete, you can get latest (which will remove any unchanged files) and then copy the "new" files over the same location. You will probably still have to and "Add Files" in the source explorer to re-pend them with TFS and then check them in.
In either case, make a backup of the files you are wanting to retain.

The simplest way is creating a branch from a Workspace Version, then check in the branch.
Please follow below steps to do that: (Backup the original project first)
Right click the project directory in Source Control Explorer >
Branching and Merging > Branch
Select Workspace Version for Branch from version By, then click
OK.
Check in the new created branch
Right click the Team Project name in Source Control Explorer and
Get Latest Version to sync delete the original branch (Backup it first).
Rename the new created branch to original one if needed.
Check in the changes
Check the remote server in page site, the project files/code will come
back.

Related

TFS Show Latest on Top Level Folder

I'm working with TFS for a bit now and my question is about a function in the Source Control Explorer.
A sample Folder Structure for my Project might be this:
Project/MyControllers/Controller.cs
I change something in the Controller.cs and I navigate to the folder "Project" inside my Source Control Explorer. There it says at the Column "Latest", yes. Which in my opinion isnt right, because i changed something inside the folder. When i navigate into "MyControllers" it says that my Controller.cs changed.
Is it somehow possible to see the "No" at the "Project" level?
I dont know if its important by my Visual Studio Version is 2017.
Thanks for your help.
This is the correct and excepted behave. The Latest column is used to show the mapping status between your local file in workspace and the correspondingly server file. Which include value such as yes, no ,not download , not mapped. It will not influence either subfolder or parent directory.
Only when the name of "Project" folder has changed such as "ProjectDone" by others and checked in, it will show the Latest status of Project with "No". This is a point to point mapping status.
And you don't have to always paying attention to the file is latest or not. In other words, you don't have to and can't make sure always working on the latest version. When you working on a file and some others make same change during you local working. TFS will record the changes and let you solve conflicts when you perform the check in action.
Usually you just need to do a get latest of the workspace or top folder in the beginning of the day of work on a project.

Excluding Files from TFS Server Workspace

We just implemented TFS in our company and I accidentaly included the bin and obj folders. I would like to exclude them. I searched on Google and found basically 2 ways to accomplish this:
1) https://msdn.microsoft.com/en-us/library/66tw9ezk(v=vs.90).aspx
In Visual Studio, open Solution Explorer and select the file to exclude.
On the File menu, click Source Control, then click Exclude from Source Control.
When you are ready to place the file under source control, you can access the File menu and click Source Control, then uncheck Exclude from Source Control.
In my File>Source Control, I don't see exclude from source control there or under advanced.
2) How do I permanently exclude the bin and obj folders from TFS 2012 checkin?
I tried adding a .tfignore and I couldn't find the 'ignore by extension', 'ignore file', etc. in teh Promote Candidate Changes dialog box. As far as I understand this is only applies to a local workspace and not a server workspace.
We set up the solution to checkout a file whenever it's altered, so when someone builds the project he acquires an exclusive lock on the dlls and then nobody else is able to compile.
After the steps Mike describes, you can go further and define an ignore rule. Undo the pending changes to the file you want to exclude and then click the "detected: 123" link that shows under "Excluded changes".
This open up a new window in which you can ignore these changes indefinitely. It does this by creating a .tfignore file and adding that to source control. The alternative to the UI is t create this file manually and checking it in. This should prevent Team Explorer from showing files that match the patterns in the ignore file.
Make sure that these files are deleted from source control, if they were checked in accidentally, you can destroy them to make sure they are truly gone. You'll need to do this from the commandline using tf destroy
The call to Destroy won't delete your local files when you use the remote itemspec to destroy them:
C:\>tf destroy /collection:http:
//jessehouwing:8080/tfs/DefaultCollection $/Scrum/test.txt.txt /noprompt
Destroyed: $/Scrum/test.txt.txt
C:\Program Files (x86)\Microsoft Visual Studio 14.0>dir "c:\Workspaces\Local\Scrum"
Volume in drive C has no label.
Volume Serial Number is 008A-AC5B
Directory of c:\users\jhouw\Source\Workspaces\Local\Scrum
12-08-2015 20:12 <DIR> .
12-08-2015 20:12 <DIR> ..
12-08-2015 20:12 0 test.txt.txt
1 File(s) 0 bytes
2 Dir(s) 297.229.512.704 bytes free
After performing a tf get /collection:http:
//jessehouwing:8080/tfs/DefaultCollection $/Scrum /recursive it will indeed be deleted. This should not be an issue if the files in question are regenerated during the next build.
See also:
https://stackoverflow.com/a/21260759/736079
If you're using a server workspace, the only way I can think of is to set a Forbidden Path checkin policy for your source control repo. It's a part of the Team Foundation Server Power Tools; you'd need to install the version of the power tools that matches your Visual Studio version on all developers' machines.
Note: these use Regular Expressions, so you'll need to adjust your pattern to match ;).
From my personal experience, the easiest way to achieve this is the following:
View -> Team Explorer (Ctrl+\, Ctrl+M)
Click on Pending Changes
In your Included Changes list, right click on the desired folder.
Click Exclude.
The excluded change should now appear in the Excluded Changes list below.

How to i use TFS with Visual studio 2010 to simulate multiple users?

i'm using VS2010 with free version of the TFS provided with codeplex. but i'm only working on one PC. i tried to simulate two users by opening two VS and login to TFS from two user names. then when i add a project from source control by file -> Source control -> Add project from source control and browse till i find the .sln file, the local path was always the same for two users. it didn't even let me change the local path. because of this when i made changes from one user it made changes to the local solution also it updated solution in codeplex but when i tried to get the latest version from the other user it always said the local solution was edited and asked to override it. but i need to update the solution in VS from the server not from the local folder. when i said NO to override then clicked checkout for edit, it never returned the updated version on server. is there away to fix this?
I need to simulate two user using two instances of VS2010. Is there away to do this properly?
thanks
You had it right in you post, login using another user, but when you create the local workspace make sure they point to two (2) separate folders. Don't point the workspaces at the same place on the disk that will not work.
So user A's workspace would be c:\A\source
User B's workspace would be c:\B\source.
All the files will be replicated in both location. Now if you modify a file in A's workspace and checkin, you'll need to do a get latest from B's VS to it's workspace.
If you modify anything in either workspace you'll need to check it in for the other user to be able to get it their workspace.
Hope this helps,
ET
You can:
1) log out and login as another user
2) use hyper-v locally in Win8+ and spin up another machine
3) spin up a VS trial machene for free in Azure

TFS error: item has pending changes but does not exist locally

The following TFS error occurs using Visual Studio 2013 to interface to TFS (TFS apparently also carries the version of Visual Studio with it):
item has pending changes but does not exist locally
This seems very wrong, as one chief purpose of TFS is to give me items that do not exist locally.
Sometimes (but not always) this occurs after a delete, and the purpose is to restore / update the file from the server.
In the Solution Explorer:
right click on file that gives error=>Source Control=>Undo Pending Changes.
right click on file=>Add file to Source control.
Now you are good to go.
Not sure about this but have you checked out a different workspace? Try going to View->Other Windows->Source Control Explorer, then open the Workspace dropdown near the top of the screen, and select "Workspaces..
As it was suggested here, just undo this change, and download will start normally.
To explain what's going on: there are certain conditions on locally changed items (files and folders), and if they are not met, TFS can interrupt downloading sources from server. One of such conditions is that item which is regarded by TFS as locally changed (no matter if you intend to check-in it or added it to "Excluded changes") should actually exist.
For example, some local file was marked to be added to TFS, but not checked in. After that, it was locally deleted from disk. But local TFS still remembers about its existence. So the message tells you that TFS is unable to download new version if the information that this file should be added still exists.
Faced similar message with VS2017. However doing source control -> undo didn't work, it produced message "No pending changes were found for " and problem persisted.
Resolution:
- do "Check out for edit" on problematic file(s)
- source control -> undo
- get latest
Right click on the problematic file in Solution Explorer and click add item to source control.

.csproj.user issues when checked into TFS

We made the mistake of allowing .csproj.user files to be checked in to TFS so we could set "Start external program" defaults. This worked poorly, especially when branching.
Now we're trying to undo this.
If I delete the .csproj.user file for a project and then try to set new project debug properties, I get:
TF14050: Cannot change item $/xxx.csproj.user
because it already has a pending change that is not compatible.
If I check in the delete and make changes, TFS then tries to re-add my .csproj.user file.
How can we fix this for existing projects in source control?
Update:
I think destroying them is the best option; we ended up just deleting them with the TFS Power Tools, though. The trick was to first Remove the Source Control File Type we had for *.user, even though it was already disabled. Now TFS appears to completely ignore these files.
I also wanted to check in .user files to do what the asker wanted, to provide defaults for the debug/run options. It turns out that the .user file is just another MSBuild Project XML file, and you can just "merge" the property group in there into your project. No need for .user files.
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartProgram>$(VS100COMNTOOLS)..\IDE\devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
I suggest that you use the Destroy command. Be careful since it deletes permanently. MSDN documentation: http://msdn.microsoft.com/en-us/library/bb386005.aspx
Start a Visual Studio 2010 Command, and use tf.exe ...
Make sure no one has the file checked-out then delete the file - checking in as a delete and not an edit.
I use Team Foundation Power Tools and do it from the Windows Shell Context menu
After you delete a file in TFS, it isn't gone yet. You need to Check-in your deletion. Only then will the file be gone.
It's best practice to then also clean your workspace to make sure the user files don't linger as read-only files.
I use TFS Git and I was able to delete the unwanted file on the server via the TFS project site. Then I synced the local project with the server.
When you open the project to sync VS might complain that you can't sync until you commit changes to the unwanted file. This is exactly what I didn't want to do, I wanted the file to go away.
However, in the change screen I right clicked the file and said 'undo changes' and that made it go away.
After, undoing changes I was able to sync and the server removed the unwanted file from my local repository.

Categories

Resources