Reputation: 3570
I cannot recall how we got this particular solution down from source control.
The current situation is:
When I explore the solution via "Source Control Explorer" I can see that it is mapped to a local workspace.
When I make changes to files within Visual Studio for the Solution, these changes show up under Pending Changes in Team Explorer.
I can check in these changes and they show up in the history for the solution.
BUT
When I right click on any file in Solution Explorer, I get the option Add Solution to Source Control...
If I choose this option, I get the message:
The item [blah.sln] is already under source control at the selected location....
I know I can fix the issue by selecting File > Source Control > Advanced > Change Source Control and then selecting each project in the solution and pushing the Bind button.
My question is:
How can TFS track changes but the solution not yet be bound to source control?
Upvotes: 1
Views: 751
Reputation: 114671
The source control bindings are stored in numerous places:
In the local machine's workspace cache the workspace configuration is kept. This data is refreshed every time you connect to that TFS server. By default this is in you local appdata folder:
This workspace information contains your machine and user information as well as the server path mapping to a local path on your workstation. You can see this information by editing your workspace information in Visual studio:
In the workspace root the $tf
folder keeps track of all files in case you're using a local workspace and Visual Studio can use these to detect changes. The Local Workspace was introduced with TFS 2012 and requires you to use Visual studio 2012 or newer, TFS 2012 or newer and to configure your workspace as Local (default for new workspaces in recent versions of Visual Studio).
The above was make sure that even with no solution opened, you can use Source Control and check-in/out files.
In addition information is stored in the project file and solution to enable deeper integration in Visual Studio.
<PropertyGroup>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {xxxxx}
SccTeamFoundationServer = http://some-other-guys-tfs-server/
SccLocalPath0 = .
SccProjectUniqueName1 = xxDemo\\xxDemo.csproj
SccProjectName1 = xxDemo
SccLocalPath1 = xxDemo
EndGlobalSection
In your case Visual Studio is relying on the first group of settings to interact with Source Control, but the second set is missing. Using the "Bind" option in the Change Sourcecontrol window will add the proper information to the solution and project files.
Since you're connected to a TFS server and the workspace mappings are synchronized to your system, Visual Studio knows that the folder containing your project is mapped to a TFS project using a workspace mapping.
This functionality is also useful when you're using another IDE that doesn't support TFVC at all, you can still use Visual Studio or the commandline to interact with TFS and operate on the workspace directly.
Upvotes: 0