Search code examples
visual-studiotfsvisual-studio-2017tfvc

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.


Solution

  • 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.