Retrieving file from source control? - visual-studio

Hi guys when I open my solution from source control(TFS 2013) in the morning some folders in a class library project does not load but they are in the windows explorer so I had to "Include in project" the folder after showing all files in the solution explorer but there are no contents even though i "Get Lastest(Recursive)" but I checked the web(Tfs) in the code -> explorer there are files shown in the tree view. Is there a problem with tfs? or visual studio? or both? what can I do to resolve this?

Looks like you have files checked-in TFS but your project file in TFS doesn't have those files included. Also, when you get latest from TFS looks like you override the local changes.

I have three(ish) suggestions:
You have the directory with the included files mapped to a different place on your local drive. You can check this my looking at your workspace mappings (File -> Source Control -> Advanced -> Workspaces). If you have more than one workspace then make sure you're using the right one.
You can force TFS to download files that it believes it has already downloaded. Instead of GetLatest, choose Get Specific version (this may be on the same menu or under Advanced - can't remember for 2010). Check Overwright writeable and all files and select Get.
Install TFS Power tools and try adding the files that way (i.e. through windows explorer)
This isn't really a suggestion, as I don't believe it will work, but if the above don't, try it. As above, select get Specific version, but instead of Latest version, select Changeset and choose changeset 1. THIS WILL DELETE ALL FILES IN YOUR WORKSPACE. The do a get latest as normal.
HTH

Related

How to update solution files in TFS when files are changed outside of Visual Studio?

I have a bunch of Word files in VS2015 solution. These files had ben modified by end user and I am trying to update them in TFS source control. What I did was I checked them out in my solution and copied user copies into solution folder in Windows10 File Explorer. I was hoping that the pending changes would include new files copies. However, when I checked them in I had a TFS message reading there were no changes done in those files. Am I missing something? Please, help if you can. Thank you.
Possible duplicate with this question How to have TFS 2010 detect changes done to files outside of Visual Studio?
The best solution is using reconcile in TFS. After you compare a server folder and a local folder, you can reconcile the differences between the folder contents and between files that have conflicting pending changes in your local folder. Detail steps as below:
Open the Source Control Explorer
Right-click on the folder with the changes and choose Compare
Select the files you want to reconcile (press CTRL+A to select all files)
Click on the Reconcile button
Set the options in the Reconcile Folder Differences dialog. Make sure Files that do not have pending changes is set to Check
Out
Click OK
If you have local changes the Check Out dialog will be shown. Set the preferred Lock type
Click Check Out

Team Explorer does not detect all adds to the local workspace

I'm using Visual Studio Professional 2015
Version 14.0.24720.00 Update 1 with TFS 2013 (30723.00).
Let's say my local TFS workspace is d:\workspace
Some of my existing projects which are not in source control are lying under d:\projects and I want to add them to TFS.
When I copy Solution_A from d:\projects to d:\workspace\solution_a_team\Main, where solution_a_team is the team project folder with a branch named Main, Team Explorer says Detected: x add(s) - where I'm assuming x is the number of files transferred.
What's confusing is that the number x is not consistent. Sometimes all files are detected sometimes only small percentage of files. What am I doing wrong, or what's the best way to check these folders into TFS?
First, please check whether there are some files adding in the excluded changes. There are included changes and excluded changes in the pending changes page.
Also, it's not recommend to just copy files or projects to the workspace folder. It's not the right way to add files in source control.
If you want to add a solution in source control, just open the solution in solution explorer and right click the solution ,in the explorer select "Add solution to source control" and choose the location you want add to. If the solution have added in the source control, there will be a lock icon in front of it.
If you want to manually add files in version control, the simplest way you can Drag the folders or files from Windows Explorer into the folder in Source Control Explorer . More details please refer the link from MSDN: Add files to the server
Moreover, you can also achieve this through TF command, or check in files through windows file explorer directly by TFS Power Tools.

Rename project folder in Visual studio and Team foundation server

My Visual Studio 2013 solution has a project "Test". I can rename it in solution explorer, but I also want to rename the project folder in disk and also reflect the change in Source Control(TFS). How can I easily do this?
Thank you
#CodeCaster, Thank you. Based on your advice, I have done some quick experiment, and worked it out. First step is rename the folder name in TFS; the new folder will appear in local workspace and all contents of the folder moved to this new folder. The old folder stays there with rest content which not belong to source control. You can delete it manually.
Or
Using TFS Power Tools to rename from Explorer.
I followed those steps to preserve the version history of the files inside of TFS:
Rename/move project file (.csproj) in source control explorer in VS (alternatively, this also works from within VS Solution explorer, simply select "rename")
Rename/move project folder in source control explorer in VS
now the project should be unavailable in VS, solution also gets closed
remove project from VS
add project (new path) to VS
fix project references in other projects
adjust namespaces if desired
adjust assembly name and default namespace in project settings
Don't know of an easier way. Was searching for this myself, and this should be the way to go.
I think you can rename it from the TFS Database.
Try going into tbl_Project of the Tfs_DefaultCollection Database, which you can find on the SQL Server Instance used by tfs. You can know which one is that by going into the TFS Console, click on Application Tier, then find the details of the Server under the Data Tier Summary. Run an update query against the project you want to rename.. I haven't tested this but just assuming it should work (some educated guess)..
I am using TFS 2015 Express and rename project is grayed out.
You can still rename the project using the TFS Site for the project.
Here is a link that shows how to do it.
https://www.visualstudio.com/en-us/docs/setup-admin/rename-team-project
I was facing a similar issue while trying to rename a folder in Visual Studio 2015.This is what I tried.
Right click on the project file
Open with Notepad
This will generate your current solution file
Change the occurences of your prev file name. (Find and Replace with the desired name)
Save it and close
Change solution explorer name and rename the folder to your desired name.
This should work.

Updating VS TFS 2010 file that is NOT in a project?

In our source control, we have a dependencies folder. It is not part of any project, but shared by a few. I have to update a couple files in there, but not sure how to go about updating these files and adding check-in notes.
How can I do this? Thanks.
EDIT: I should mention. These are DLLs, so it's not like I can edit them directly.
Go to Team Explorer
Open the Team Project
Double-click the "Source Control" node
This will display the Source Control Explorer, which will let you check out and check back in.
You can manually check out the files, then edit them in your favorite editor, and manually check them back in.

TFS View History in VS2010 for all files under a Solution

I'm trying to view history in Visual Studio 2010 for all files included in a given Solution file via the Solution Explorer View. I use TFS 2010 for source control, and I'm aware that I can get history for a folder recursively in Source Control Explorer. My issue is that we have multiple projects in a root directory, all of which are included in a variety of solution files in that same directory (each solution file represents a deploy-able component, including some "shared code" between them). I just want to view history on all of the files included in a given solution file, and not everything in this root directory. When I right click on a solution or project in Solution Explorer and "View History", I just get history for that solution file or project file, nothing more.
Alas, this cannot be done with TFS as it is.
TFS Source control does not know if a file is a solution file or a text document. It just stores it for you. There is no parsing at all. I can (and do) store Delphi project files in TFS. There is no way for TFS to be able to understand and be smart about every file type that exists.
It would be nice if Solution explorer did this for you (as it is specific to your project). But it does not.
You could create a custom plugin to TFS and Visual Studio to do what you are asking, but it would probably take longer than just manually checking the history of all the files in your solution.
This might help, it's an add-in extension
VS 2010 and VS 2012

Resources