What's best way to know which branch & which workspace I'm working on - visual-studio-2012

I'm using VS 2013 with TFS online. I have several branches and workspace.
When I open a solution, I cannot easily tell which branch and which workspace I'm in easily.
In old vs source safe, I can tell by Source control BIND. The current open solution is bound to a branch and workspace. Where can I get the info properly? Source Control Explorer, Team Explorer seems not good enough.

After research, I confirm that VS does not tell which branch you are working on.
You can do as timB33 does. But, this does not tell you that you are in which branch.
Team Explorer and Source Control Explorer shows identical for both solutions from different branches.
For sure, I do open folder by "Open Folder in File Explorer" on a project or solution. The folder path that I always setup with proper branch structure tells me 100% where I am.
I wish VS improve to display the current folder path or TFS path of 'Source Control Explorer' for the current project or solution on Title or Property or Team Explorer.

I organise my workspaces like this:
C:_ws\tfs\collnZZ\dev\dev04
C:_ws\tfs\collnZZ\fb\fb01
C:_ws\tfs\collnZZ\main\main31
I also keep an eye on >TeamExplorer>SourceControlExplorer and then I look at Workspace and expect my local path (beneath workspace) to be mapped.

Related

How to change TFS workspaces and access associated local code in solution explorer

Just learning about workspaces in TFS/Visual Studio 2012. I am testing using a Dev Branch and a Release Branch. I have setup workspaces that map to each of these branches from the server to the local folders.
Now I was assuming, and maybe incorrectly, that when I changed the current WorkSpace via Source Control Explorer, that since the workspace knows the mappings, it would then switch my Solution Explorer to show the local folder files associated with that workspace. This is not the case. Again, I was thinking it would act like FileZilla when you choose a site bookmark, that it then knows to connect to the server side code and then the corresponding local code....
So how do you actually access the local code in the Dev branch and then switch to the Release branch local code? Do you just have to close the Dev solution, then open the Release solution?
I see that this works, but it is confusing to know which version you are working with as the solution name will be the same when it is displayed in the Solution Explorer. You have to maybe r-click and view the properties of the file paths to see which actual version (Dev or Release) that you have opened. Same issue when opening VS and it lists the same solution name under the Recent section...you have to hover over it to see which version you want to open...all in all, it just seems like there is a decent chance that you could confuse the 2 and start coding in Release when you mean to code in Dev... I know you have to be careful, but this definitely doesn't help.
It would be nice, and maybe I missing this, if from when you first open VS that it would give you the option to open a WORKSPACE instead of a solution/project. At least that way, you can name your workspaces to be meaningfully different.
Unless you have rely big code bases I usually have a single workplace for all of my dev work. That way I just open any solution that I want.
I use workspaces for other tasks, like admin or merging... Or bug fixing on specific versions.

How do I rename a solution-level folder in TFS?

I'm using Visual Studio 2012 and TFS Express. I have the top level collection 192.168.100.100\Collection; under it I have a project for each program; under those I have the solution folders. So in the project folder FooBarBaz I have the solution OldName. (I'd rather not post screen shots of the folder tree, but I can rig up an ASCII art depiction if needed.)
I want to rename the folder OldName to NewName. I have already successfully renamed the solution itself and checked that in. I have also successfully changed my local mapping from ~/Projects/OldName to ~/Projects/NewName.
In MSVS Source Code Explorer, when I right-click on OldName the context menu options Rename and Move are both greyed out.
How do I rename the folder in TFS? I am the team's TFS admin so I can use the web-based settings and I can also use the TFS control panel on the host system.
Right click on the folder name in the left panel.
Also, you must have those folders mapped into your current workspace.
Pre-step assumption: Create local folder with solution and project under it and added solution to TFS. TFS now has a path in TFS pointing to a TFS folder that contains your added solution. This location is bound to the location on your local machine that is likely out of sync with the path structure represented in Source Control Explorer.
You want to rename the folder in TFS that holds your solution. When I right-click in Source Control Explorer, “Rename” is grayed out. It appears that TFS wants the TFS path to match your local path structure.
In order to rename the TFS folder I had to:
Check everything in
Remove binding to source control
Do a get latest - TFS assumes structure inherited binding - so whatever the folder is named and where it is in the TFS path structure, the get latest will create a local folder to hold the code.
Now, right click on the folder and do a rename in Source Control Explorer.
TFS and your local workspace are now in sync. If you now go and rename the TFS folder that contains your solution, the next time you open the solution, your local folder name will be automatically changed to match TFS.
Of course, don’t forget to go back later - after VS has released the lock, and delete your old/first/”no longer bound to TFS” version of the local solution folder.
I hope this helps someone else.

All files are marked as read only after check in to TFS from Visual Studio 2012

I have a solution with two projects. I just marked the solution and checked it in and now all files have that little image of blue padlock on the left side which obviously means that they are marked as read only.
I've been working only with Tortoise SVN till now and this is my very first check in to TFS, so why does this happen, or if it is too complicated for an answer here, at least how can I return the state of my files (the entire solution maybe) to normal.
Also I've been struggling to find a good reading/tutorial on how to use/execute the basic tasks for TFS from Visual Studio 2012 so if someone can share a good source of information about the topic it would be much appreciated.
This is, in fact, normal. You are using a "server workspace", or connecting to a TFS server from before TFS 2012. Team Foundation Server has multiple modes of working:
A Checkout/Edit/Checkin system (via "server workspaces") means that you will need to explicitly check a file out to begin editing it. Files are kept read-only in order to indicate to you quickly what files are checked out and which files need to be checked out. If you simply start typing in an IDE or editor that understands TFS version control (Visual Studio, Eclipse) then the IDE will check the file out for you. Otherwise, you will need to check the file out manually (by selecting "Check Out for Edit" in Source Control Explorer or by running tf checkout <filename>.)
This type of system is very useful with teams that have very large repositories or very large files in those repositories; by explicitly instructing the source control system that you are editing a file, you avoid the need to scan the filesystem.
An Edit/Merge/Commit system (via "local workspaces") means that you do not need to take any explicit action to check a file out, when you query your pending changes, the disk will be scanned to determine what changes you have made. Local workspaces are the default in TFS 2012, though you or your administrator may change this default.
This is similar to the way Subversion operates and is generally suitable for most repositories, however if you use keep large binaries in your tree, it is probably not a good option.
A Distributed Version Control system (via git) means that you have a complete clone of the repository locally and allows you to work completely independently while offline and share your changes or receive other peoples changes as you see fit. Git is new in TFS 2013 and Visual Studio 2013.
This type of system is very useful for highly distributed teams and teams that want to take advantage of novel branching strategies but may not be appropriate for teams who have very complex requirements around fine-grained permissions.
If your server is TFS 2012 or better and you want to convert your existing server workspace to a local workspace, you can open the "Edit Workspace" dialog and in the advanced settings, change the type of your workspace. This will make all your files writable and you will continue working in a Subversion-like mode.
this is quite normal, having locks to the files.
However, you can set the level of source control of different check in / check out strategies.
link: http://msdn.microsoft.com/en-us/library/ms181237(v=vs.90).aspx
For the global documentation :
Source control : http://msdn.microsoft.com/en-us/library/vstudio/ms181368.aspx
Tfs global : http://msdn.microsoft.com/en-us/library/vstudio/hh529827(v=vs.110).aspx

Can't get workspace project to reflect latest changes tfs visual studio

After using a "GetLatestVersion" to retreive my coworker's new project added to Source Control, we realized that the folder structure was incorrect. He deleted the issues on Source Control and everything looked great there. It runs on his end.
Unfortunately for me, even after running the "GetSpecificVersion" and checking all the overwrite boxes, I cannot get the new version of his project on my local workspace.
Ok.
How now do I delete the project on my end without TFS knowing (so I don't have toCheckInanything and TFS doesn't think it needs to bring anything onto the server from my local workspace).
It makes most sense to me to:
- log out of Source Control, close the project and Visual Studio,
- go into my workspace folder and delete the coworker's broken project
- log back into Source Control, bring up the workspace project in Solution Explorer, and re- "GetLatestVersion" and overwrite files.
Has anyone had this problem before? I'm working in VisualStudio 2012
Are you 100% positive that your co-worker did in fact check in all of his changes that "fixed" it? I would start by double checking that. In team explorer, make certain that they do not have any files that need to be checked in under "Excluded Files".
If you have a TFS Build Server, make certain that the CI build (or you can manually run it) was successful. This will at least prove whether TFS has the project buildng correctly.
If you don't have a TFS build server, have another co-worker pull it down to verify that everything got checked in correctly.
If you are sure that they checked in everything ok and it is still not working for you, try pulling it down to a different directory. Also, you can manually delete your copy of the solution through file explorer and then pull it down again (with the overwrite checked).

Using local TFS workspace for non-VisualStudio source code

I am trying to use TFS storing non-VisualStudio source code. Working with Visual Studio 2012 and Microsoft's online Team Foundation Service.
I've setup a TeamProject and mapped its root to a local folder. All it contains at the moment is a BuildProcessTemplates folder in it. (which was created as part of the TeamProject)
I copied my source code externally (using windows explorer) into the TeamProject root folder on my hard drive and since my TFS workspace is NOT a server workspace but rather a local workspace, I was expecting VS to detect the folders/files and show them in Pending Changes window .... yet it doesn't.
Interestingly, new files in the root folder are detected as "Excluded Changes" but new folders are not detected.
What am I missing?
First make sure the newly added folders contains files.
Are there any Detected changes shown in the Excluded Changes section?
Pending Changes > Detected changes link > The Promote Candidate Changes dialog box appears > check the files you want and click Promote.
I can't say I have ever noticed nor expected TFS to automatically pick up files or folders added to a mapped directory as pending changes.
I always just add them manually using the 'Add existing items' option from the source control view.
It may actually do (or at least be meant to do) the auto-detection, but I can't say I've ever relied on it. I don't think it's something to fret too much about - adding them manually is easy enough, and the 'Add existing items' option is usually smart enough to show you which files are not already under source control, so even if you need to add even more files later, it shouldn't be too much extra effort.

Resources