Does Visual sturdio creates a workspace for every tfs project? - visual-studio

I am new at using tfs online and create projects. When I am creating a project on TFS online platform, and connecting from visual studio. So I need to map project on my disc. And I see a workspace that has same named my computer name. Does visual studio creates a workspace on visual studio for every tfs project? What is the goal of workspaces?

A workspace represents a mapping between a location in source control ($/SomeTeamProject/SomeFolder and a location on your computer (C:\SourceCode\SomeTeamProject\SomeFolder).
That's all. It's a very straightforward concept.
You can maintain multiple workspaces for purposes of isolation, or just have one workspace mapped to the team project collection root ($/), which means that every team project in the collection will be mapped in the same workspace. It's entirely up to you. The advantage of multiple workspaces is that you can explicitly avoid doing things like modifying a bunch of stuff across branch or team project boundaries inadvertently. If you have a workspace for a development branch, you'll only be able to check in a set of files in that branch. If you want to check in files in another branch, you'll have to switch workspaces. It can be a nice sanity check, but it's by no means a necessity.
Workspaces can consist of multiple mappings (for example, $/Foo/Bar -> C:\Foo\Bar, $/Foo/Baz -> C:\Foo\Baz would map those two folders, but ignore any other folders under $/Foo).
Workspaces can also contain cloakings -- explicitly excluding a folder from being mapped. So you could map $/Foo/ and cloak /$Foo/Bar if you wanted everything under $/Foo except the Bar folder.
Workspaces come in two flavors: Server and Local.
Server workspaces were the default from TFS 2005 up until TFS 2012. In a server workspace, every activity you take in source control has to happen through Visual Studio (or an equivalent IDE) -- starting work on a file contacts the server and checks the file out. Files are stored in the file system as read-only unless they're checked out.
Server workspaces are, generally speaking, awful. I do not recommend using them except for in a few very specific cases.
Local workspaces were introduced in TFS 2012 and were first supported (not surprisingly) in Visual Studio 2012. Local workspaces are slightly more Git-like in that editing files does not require an explicit check-out on the server -- you can edit a file at any time in any IDE. This allows you to work offline in a very limited fashion.

Related

Unsupported pending change error when moving folder

I am trying to move a folder in TFS 2010. After coming to grips with the fact that TFS can't do this without losing the folder's history (see this question and users' responses to Microsoft), I tried the following TF.EXE command:
tf rename Apps "Test Main\Apps"
But I get an error message.
TF10169: Unsupported pending change attempted on team project folder $/Apps. Use the Project Creation Wizard in Team Explorer to create a project or the Team Project deletion tool to delete one.
The Apps folder does not appear to have any pending changes but I tried some other folders for good measure and got the same result.
I do not want to create or delete any Team projects. What am I missing?
$/Apps is not a folder, it is the root of a team project. Think of it as "C:\". You can create folders underneath it, but it's a special entity with its own set of rules.
So, what does this mean for what you're trying to do? It looks like your goal is to rename the team project. Unfortunately, TFS 2010 does not support renaming team projects, although TFS 2015 and beyond do.
If you want to rename the "Apps" team project, you will have to upgrade to a modern version of TFS, but at a minimum TFS 2015.
Otherwise, you will have to manually create a new team project with your desired name and check in the source code. You won't be able to move it from within the source control explorer.
However, keep in mind that there is more to a team project than just source code -- any work items or build definitions will not transfer to the new team project, and there is not a mechanism for moving them.
So, your options are:
Live with the name
Upgrade to TFS 2015 or beyond (ideally the most recent version, of course)
Create a new team project

Working with multiple copies of Visual Studio, each connected to a different solution and maintaining separate sets of included changes

I have two copies of Visual Studio 2017 open and each window is working with a separate solution. Both solutions are checked into Team Foundation Server source control in separate folders. For example, \Projects\Project1 and \Projects\Project2. There are no files common between these two projects.
When I add a new file into \Projects\Project1 using Windows Explorer, it appears as an entry in both copies of Visual Studio under "excluded changes". If I add the file through Visual Studio, it appears to get added as a file that's referenced by that solution (or project) and appears in the included changes for that project.
How do I configure Visual Studio to not add arbitrary files that exist outside of the solution folder into the detected files list?
In Visual Studio, under Excluded Changes, there is a View Options link with a Show Solution Changes option as well as a filter. However, neither of these options stops the inclusion of files that belong to other projects. It is as if the root of the detected code has been set to the parent folder of both solutions.
Since you are using a local workspace, first please go through below mechanism of detecting files:
While edits in a local workspace can be pended implicitly just by
editing the file, adds and deletes still must be explicitly pended.
However, TFS version control’s workspace scanner also detects new
files which are ‘candidates’ for addition, and missing files and
folders which are candidates for deletion. The Team Explorer’s Pending
Changes Page has a link which shows the number of detected adds and
deletes, and provides a link to the Promote Candidate Changes dialog
which can be used to pend ‘real’ adds or deletes on these items.
This is called “promoting” the candidate adds and/or deletes – because
they become real pending changes.
Source Link: Server workspaces vs. local workspaces
In your case, since you are adding files using Windows Explorer, TFS will add the files in excluded changes, you need to manually promote the files as real add in pending changes list. However, TFS could not judge the exclude list should belong to which Visual Studio. That's why it appears as an entry in both copies of Visual Studio under "excluded changes".
How do I configure Visual Studio to not add arbitrary files that exist
outside of the solution folder into the detected files list?
There is no way to do this for local workspace, unless you are using server workspace, but there are also many limitations.
Another workaround is configuring multiple projects which have multiple TFS workspaces. You could have several branches for different projects under the main or dev branch, and create a different workspace for each branch. Each branch is a 'project' in itself.
It is as if the root of the detected code has been set to the parent
folder of both solutions.
Correct. It sounds as though you have a single TFVC workspace mapped to a single root folder. If you have a single workspace mapped to a root folder, all changes in that folder will be reflected in the team explorer.
The solution: Use multiple workspaces, one for each project. If you're not familiar with the concept of workspaces in TFVC, there is extensive documentation available on the subject.

Repair TFS Server Workspace

I use a server workspace for my Visual Studio / TFS setup because our project far exceeds the 100,000 file recommended limit for local workspaces.
One of the drawbacks of a server workspace is that Visual Studio cannot automatically detect changes to files in the workspace if these changes have been made outside of Visual Studio.
If I believe there may be undetected changes lurking in my workspace, how can I tell Visual Studio to actively/explicitly check the integrity of the workspace. I.E. I need a "get" operation that assumes that zero pending changes may actually be incorrect.
There is a PowerTools command tfpt online which looks for files which have had their read-only attribute removed (if you were messing with them on the train home for example) but I guess you might have new files and need something like detected changes in local workspaces.
If you go into Source Control explorer you can right click your folder, select compare and then play around with what you need to compare the server to your local copy (file types, new files, different files etc)
TFPT Online:
http://blogs.msdn.com/b/buckh/archive/2005/11/16/power-toy-tfpt-exe.aspx
If you are using TFS 2013+ and Visual Studio 2013+ then you can use the "tf reconcile" command to analyse the differences.
https://msdn.microsoft.com/en-us/library/bb385984.aspx
The power tools "tfpt online" command has been depricated for some time.

TFS2012 reflect changes to server

I'm having trouble setting TFS2012 to control project source files between 3-4 people.
I've been googling for 3 days, and now I'm completely lost trying to map local and server folders in workspace. So far I have managed to create a server, a project, and connect to it using Visual Studio 2010.
All I'm trying to achieve is to share one solution between this group of people, lock files for changing, and reflect those changes to server (and therefore to other people in my group) after I check in the file I made changes to...
Can someone explain how to set this up??
Workspaces are set up the clients, not the server.
So, in Visual Studio (including Team Explorer if you have only the TFS client without the rest of VS) connect to the TFS instance and select the right team project.
If VS does not immediately prompt you to create a workspace (it's been a while since I did this on a refresh install) go to File | Source Control | Advanced | Workspaces...
There you can select or create a workspace (remember workspaces are specific to the combination of user and computer). Once you open a workspace to edit you can create mappings between source control paths and local paths.
NB. in the workspaces dialogue you can select "Show Remote Workspaces" to see other users' and computers' workspaces and copy mappings to paste into another.

We have an issue connecting TFS workspaces to versions of Visual Studio 2008, 2010, 2012. We get "The path … is already mapped in workspace " issue

Here is what we are trying to do:
In a TFS collection we set up a TFS project “BuildBusinessWebsite”. For this project we will have .Net solutions, SQL Server Reporting Services (SSRS) reports, and SQL Server Integration Services (SSIS) packages. (I have to do development on all three.) We have chosen to set up a folder structure like this in Source Control Explorer with solutions and code in each directory folder:
BuildBusinessWebsite
Development
Application
SSRS
SSIS
Test
Application
SSRS
SSIS
Production
Application
SSRS
SSIS
Now, we are currently developing the SSRS reports and the SSIS packages using Visual Studio 2008 and the application is being developed in Visual Studio 2010. When you connect the second Visual Studio 2010 environment to the same working directory (Local Path: Not mapped) you get the error “The path … is already mapped in workspace …” issue because it is already mapped to the Visual Studio 2008 directory. I need both environments mapped to the same directory as I do not want to keep multiple directories on my machine up to date with “Get Latest”. I am also currently testing the migration to Visual Studio 2012 where it is also asking me to map another location for TFS. My current work around is to create another layer of folder mappings as C:\TFS2008, C:\TFS2010, and C:\TFS2012 with the folder structure above in each. Is there a way to consolidate all these for one location for all the code?
Second issue related to the above is with branching and merging: If there is some way to fix the above then this one is moot, however, when pulling down the folders above from source control and you are utilizing branching and merging, the branching and merging connections between prod, test, and dev do not seem to pull from TFS. They seem to be local to my workspace and machine. Considering the example above where I branch my application from Production to test and test to Development in Visual Studio 2010, when I use Visual Studio 2012, map the Source Control Explorer to another location on my hard drive, and “Get Latest”… After it comes down I lose my branching and merging having to set them back up. Is there a better way to set this up?
Thank you all ahead of time for reading this and thoughts you might have would be greatly appreciated.
TFS Workspaces are uniquely identified by:
Workspace Name
Workspace Owner (AD Account name)
Computer Name (The Computer which it is on)
Team Project Collection it is in
The workspace mapping should have nothing to do with the "environment" you are working in. You should either use the TF Admin command to create your workspaces or go to File->Source Control->Advanced->Workspaces... in Visual Studio. Also, create only 1 workspace and do it at the root folder.

Resources