Get TFS Difference files in a project Visual Studio 2010 - c#

Recently, It happened that a Project was replaced in a solution from Windows Explorer. when we reopen the solution in Visual studio it prompted for reload of the modified project but can't see what files in those project are different from TFS Copy (a red check mark indicating file checkout/modified was missing).
Is there any way that we can compare the files that were actually different from TFS Copy for this specific project?

TFS is a source repository, hence it keeps track of all changes made over time.
All you need to do is as follows:
Open the TFS Solution in the TFS Source Control Explorer
Identify the Project directory from within the Source Control explorer
Right click on the project directory in the Source Control explorer
Select the menu option View History
Now from there, select any changeset (set of changes at a point in time) and compare that with either a previous change set or your local changes
Note: in order to compare a specific changeset with your local copy, you need to right click on a changeset and select the "Compare" menu option to compare
Note: in order to compare the differences between two changesets, you need to select the two changesets, right click on it and select the "Compare" menu option

Related

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

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.

Checkout A Project With Git And Visual Studio

I recently started using Git with Visual Studio 2015 and I'm trying to modify the properties of an installer project. The issue is that it won't let me because the project isn't checked out and I don't see an option to check out the project with Git through Visual Studio. The only place I even see the mention of the words 'Check Out' is under branches and it's grayed out.
I'm having the same problem in VS2015. It seems to be an issue with the Installer Project extension. For some reason Visual Studio doesn't detect when you attempt to change the Setup Project file (with YourProject.vdproj), and doesn't automatically unlock it for you. I had the same problem with TFS, but in that case all you had to do is manually unlock the file, by right clicking on it. I've just migrated to Git, and the problem is still there, but now you can't unlock the file by right-clicking on it (since there is no explicit check-out in git).
I'm still looking into the problem, but the only solution I've come up with now, is making a quick manual edit of YourProject.vdproj in Notepad. Visual Studio WILL recognize that edit, and unlock the file for you. After that you can continue to use IDE to make changes to the Installer project.
Unfortunately, the problem comes back once you check in your changes, and try to modify the file again. You will once more have to manually edit it to force Visual Studio to unlock it for you.
EDIT: After spending a few hours on this, I finally came up with a proper fix, which I verified works on a few in-house projects. Here are the steps:
Open your solution file in notepad, and delete the following section: GlobalSection(TeamFoundationVersionControl)
Open the solution containing locked Setup Project in Visual Studio.
Go to Tools > Options > Source Control > Plug-in Selection, and pick 'None' from the dropdown.
Click Yes to the dialog that warns you the project will be closed.
Open the solution again, you will be prompted to permanently remove
source control bindings from the projects. Click Yes to that.
You can now go back to Tools > Options > Source Control > Plug-in
Selection and pick Git again.
At this point the problem is fixed, and you will be able to modify
your Setup Project without any issues.
I found that removing bindings is clearing the values of the following tags from the project files:
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
Apparently SAK stands for 'Should Already Know'.
Here is a workaround I found,
Mark the project installer in the Solution explorer, And click "Save" (not save all).
For me it did the trick.
If it's still didn't help try to reopen VS and try the method again.
Cheers!
Open a command line, go to where you need to check it out, then issue the git checkout command? http://git-scm.com/docs/git-checkout
Like Eternal21 I encountered this problem when trying to modify an Installer project, this was in a VS2013 (rather than VS2015) project though and I could not see a GlobalSection(TeamFoundationVersionControl) in the solution file. However the following steps worked;
Go to Tools > Options > Source Control > Plug-in Selection, and pick 'None' from the dropdown.
Make the change required to the Installer project
Go back to Tools > Options > Source Control > Plug-in Selection and select Git again.
(and the Solution did not ask to be closed).
You need to create a new empty repo on your Git server first, then clone it to a folder on your local computer.
After that you will be able to add your project and check it in by adding it to the local folder.
I was able to work around this problem by simply editing the vdproj file (setup project file) manually in Notepad++ (you can use any text editor), making some temporary changes into it (type a character and backspace) and saving the file. This effectively checks out the project from GIT. Now you can come back to Visual Studio and make whatever changes you want.
I was able to use dotNETs suggestions and edit the vdproj file. Simply adding a character and removing didn't work, but making an actual edit did. Doing so triggered the check out for GIT. In my case I was attempting to change one of the Detected Dependencies exclude property to false and was able to do so while editing the vdproj file. Once I saved it then reopened Visual Studio the check was displayed on my installer and the change was already applied. I was able to make additional changes while checked out.
Once finished and I checked it in, I could no longer edit and needed to manually edit the file again to check out.

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.

Restoring delete files with visual studio 2012

I have accidentally removed part of my project thinking that I was in a temp folder.
It is an asp.net-mvc 4 application.
I donĀ“t have tfs or any other program monitoring my filesystem.
I had just publish my application. All I have left is a bunch of compiled files, js, css and images.
Is there any tool from Microsoft that I could perform a reverse engineering with or does VS2012 keep track of files so I could restore it.
Files you delete in Visual Studio go to Windows recycle bin. Unless you cleared it, your files should still be there. Just restore them and than add them to your project as existing items. You can also drag and drop them through Solution Explorer.
EDIT:
You can also click the "Show All Files" button in solution explorer.
The file will appear there, grayed out (if it was only removed from your project - not your disk drive). Then you can right-click it, and add it back to the ptoject. If it's not there try the first approach.
Open folder/solution of the deleted items in 'Windows File Explorer'
Press Ctrl+z (undo). This will instruct windows to undo the last actions on the folder
Go to the Visual Studio solution again
Click 'Show All files' icon on Solutions explorer
Click Refresh
Include the files again
PS. Its always safer to use a version control system, to make sure you can retrieve not just the file itself but any previously checked-in state. http://www.incredible-web.com/blog/revision-control-systems/
Try this:
Right click in your project;
click on "Open Folder in File Explorer";
open your project folder;
once the project folder is open just do a "ctrl + z".
Deleted files in visual studio should end up in the recycle bin if you have it enabled. If it has not been cleared out, you can restore it.
No file is really "deleted" when you delete it. It is usually marked as deleted but still can easily be restored by tools. One such tool is made by a company called AccessData that makes forensic investigation software called Forensic Toolkit. They have a program called FTK Imager which can create an image of a drive or folder and even show you deleted files which you can restore. This portion of their software is free. FTK Imager Download Maybe give it a try.
Lastly, learn to use subversion or other version control software (git, tfs) so this doesn't happen to you in the future and backup your stuff
Sorry i'm explaining in Visual Studio 2015, but options are same, just go through my steps.
Step 1: Open solution Explorer, right click on your project then Click on Open Folder In File Explorer.
Step 2: After open file Explorer Press "Ctrl+z" keys, this will have undo your deleted files.
Step 3: come back to visual studio, press refresh icon in solution explorer, you would have find your deleted files within dotted box.
enter image description here
Step 4: Right click on the Dotted file and select Option include in project.
enter image description here
that's it. now your deleted files are included in project.
Windows OS creates restore points when Windows Updates are applied. If you damaged a code module, like I did today, you might be able to right click on it from Windows Explorer and choose "Restore previous versions". The same option is available at the folder level.
Go to the Visual Studio solution
Click 'Show All files' icon on Solutions explorer
Click Refresh
Include the files again
and you can visit: Remove git mapping in Visual Studio 2015
There was only one project in the solution & I accidentally removed it. Good thing was I realized it on earlier stage & when I tried to close the solution, visual studio asked me to save the solution file. I said no & when i reloaded that solution, project was there.
Yeah, it is easy to restore.
Step 1: Go to recycle bin and restore the deleted items.
Step 2: In Visual Studio ,right click on the project and click add > Existing Items (Here you can add the deleted items)
On the top bar menu, select file then on the drop-down select Revert file
The deleted file will be restored.
Go to Source Contror in the left side of visual studio code editor and click on it , you will see the deleted files , mouse hover on file and click on Discard Change.
Your file will restore .
Just go to Recycle Bin and press the restore.you will find the deleted file in the file explorer in the software file.

"Add existing item" in Visual Studio: is it possible to make "Add as link" default?

As pointed out in this SO answer, the Add > Existing item dialog in Visual Studio by default displays the Add button (meaning that the selected items will be physically copied to the new location), whereas the desirable action is often (always?) to Add as Link.
Is it possible to configure Visual Studio so that Add as link is selected by default when opening the Add > Existing item dialog?
I have thoroughly searched the Options dialog in Visual Studio and examined the MSDN documentation for an answer to this, but so far to no avail.
Project Linker would be a good option for automated linking when two new projects are to share the same code base. However, when linking a large number of files from an existing to a new project, one seems to be confined to the Add > Existing item approach, and this work could be much more convenient and less prone to error if Add as link would be the default action.
Unfortunately, there is no option for that. But there is silver lining. You can drag files to a project and drop them to desired folder. Files are copied to your project. If you press Alt key doing drag and drop operation, files are not copied but linked instead.
You can also use VSCommands extension which adds 'Copy as Link' on folders and files in Solution Explorer. After that you can do 'Paste Link' in desired location. It also allows you to navigate to source item from linked item via 'Locate Source File' from cotnext menu. Works with vs2010 and vs2012.
It appears that when you "Add Existing" to a SOLUTION FOLDER(as opposed to an actual folder), then you are always adding these items as a link.
If you add existing items to an actual folder, then you get the button that gives the option for "Add as Link".
Simply Edit project file and change the path of the file.
You can relatively move folder up using ../
It starts in the project folder.
I found an nice tip here:
If you want to add an existing item as link in VS C# Express 2010 in the "Add existing item" dialog you have to explicitly choose Add As Link from the dropdown on the Add button.

Categories

Resources