how can I get 1 workspace per solution? - visual-studio

i am using vs.net with tfs. I have 1 workspace at the moment for 1 solution. I just did a get latest from another solution but now it already checks stuff out in the same workspace? how can I get one workspace for each solution so every things stays seperate?

With opened 'Source Control Explorer' navigate in VS to
'File' > 'Source Control' > 'Workspaces...'
From there you can generate any number of workspaces, containing any number of source control paths.Once you have generated your workspaces you toggle from one to another from within 'Source Control Explorer'

Inside a workspace you can create several mappings. A mapping links a directory in your source control to a path on your local drive. You can map *$\Team Project\trunk* to c:\temp and $\Team Project\Component\Subcomponent\trunk to *c:\somepath\someotherpath*.
Now you can call Get Latest. This can be done on several levels:
Get Latest on $\
Get Latest on $\Team Project\
Get Latest on $\Team Project\trunk\
The first one updates all your local mappings because the Get Latest has been done on the topmost level of your source control.
The second call will also update both mappings, because both mappings are below *$\Team Project*.
The third call will only update your first mapping because it's the only mapping below this path.
So the conclusion is: You do not have to separate your Team Project mappings into several workspaces. You just have to take care of the level you call Get Latest on.

Related

what is the keyboard shortcut to search for a file in visual code

I am working on a macbook .I have my repository synced in visual code through sftp and I would like to search or go to a file in the repo.When I do a CMD+P it goes only if the file is recently opened.But is there a way to traverse to a file which is not opened , but exists in the repo ?.
hit the Command + p and search through your project files
Maybe the new process of downloading and indexing the entire repository will help you find those files without having to open them.
You should test it in v1.65:
Workspace search and find all references will now download and index a
full copy of the repository by default, rather than defaulting to
providing partial results as before. There are several settings to
configure this:
remoteHub.indexing.verboseDownloadNotification: controls whether the download notification is shown as a popup (default) or in the
status bar
remoteHub.indexing.maxIndexSize: controls the size limit of indexes to download - if this is exceeded the download will be
cancelled and partial results will be provided. Leave this empty to
never download repositories and use partial results always.
from v1.65 Release Notes

How to gray out items in Source Control Explorer?

I accidentally hit "Get Latest Version" on item in TFS with which I'm not currently working on. This made name of the item visible in black in Source Control Explorer, which is misleading to me since I'm used to identify objects which I'm working on visually. How can I reverse this operation?
To make the item in Source Control Explorer gray out again. You could try below workaround, get specific changeset 1.
Open team explorer
Click Source Control
Right click on you file/folder
Select Advanced Click on Get specific Version
Choose Changeset Type and enter 1
The item in Source Control Explorer will gray out again. This is due to:
Changeset 1 is a special changeset on your Team Foundation Server
instance. It was created as part of the setup routine and only
contains one thing - the root node ($/) in your source control tree.
If you do a get for Changeset 1 on any actual files then they will not
exist at that point in time on the system so will be deleted locally
and the server will know this.
Note: This will change the status of your files to "Not downloaded" and will remove the local copy of the file. It will only remove files that were put there by TFS.
Assuming you are using TFVC, you can also try cloaking the folders that you don't need. This will "remove" the any unchanged files locally and exclude the folders when you get latest in future.
In the Source Control Explorer, right click on the folders that you want to exclude and go to "advanced" then select "cloak".
To start using the files locally, you can go to the same place and select "uncloak".

Checked out files related to loaded solution

I am using VS2015 and I work with 4 different projects and sometimes 2 different branches for a project. In VS a Team Explorer, under Pending Changes I see all the files checked out, from all the projects ( they are all host on the same tfs server). Each time when I want the make a commit I need to check to have only the files from the current opened solution and not check in anything else.
I was wondering is there is a tool/extension/option to only view as pending changes the files that are included in the current solution (the one that is opened in VS). This way I do not have to worry that I when I do a commit I include files from a different project.
Map different workspaces and switch between them as appropriate.
Just right click the solution/project/file in the VS solution explorer > Check In> then Just the files included in this solution/project/selected file in the Included Changes section, other files will be listed in Excluded Changes. So you can click Check In button directly.

How to clear Visual Studio workspace

I have a workspace in VS2015 (same problem in 2013) that I'm trying to completely remove and start fresh with a copy from the server. To clarify, I want none of the files or changes that currently exist and I want to start completely fresh with the server copy of all files. I don't know how to correctly do this, however. I've deleted the workspace, the actual files that the workspace pointed to, and I've cleared the cache locations below, but VS still shows that the workspace exists and won't fix itself. In fact, it still shows the mapping even though I've triple-checked that it's deleted.
I'd like to avoid using devenv /reset since I'm pretty customized and I don't want to fix all of it, but I'll do it if it's unavoidable. How can I accomplish this?
Locations cleared/deleted:
%LocalAppData%\Temp\<all VS files/folders>
%LocalAppData%\Microsoft\Team Foundation
%LocalAppData%\Microsoft\VisualStudio\<version>\ComponentModelCache
On the window where you can get a specific change set from TFS, get the changeset with id "1". This is the situation just before the project was created - empty!
Right mouse om project node in solution explorer
Source Control > Get specific version
Version type "change set"
Input change number "1" (without quotes)
Click "Get"

How do I get Visual Studio Team Foundation Server to see I moved code to a different folder?

I moved some code from my c drive to my d drive. When I opened the solution, it told me that:
The solution appears to be under source control, but its binding
information cannot be found. Because it is not possible to recover
this missing information automatically, the projects whose bindings
are missing will be treated as not under source control.
So I tried permanently removing the bindings and downloaded the latest version. Now my changes don't register as pending changes.
I've tried selecting the solution in the Solution Explorer and File => Source Control => Change Source control, but it does not let me bind. Server Name and Server Binding columns have "".
Generally speaking, the location of code on your machine is dependent upon where your workspace is located.
If you move your workspace to the D: drive, then there shouldn't be an issue.
However, if you simply used Explorer to copy the files to the new location, then VS isn't going to be able to maintain the bindings.
From the Workspace Editor you can map the entire tree, solutions or even individual projects to a new location.
First off, put it back and undo the changes.
Then, Go to File | Source Control | Workspaces.
Click on the work space name and then the "Edit..." button.
In the working folders area select the source control folder you want to move and give it a new local folder location.
You will need to edit your Workspaces for TFS Server to know the change that has happened at your local machine. To edit your workspace, in Visual Studio:
ensure you have no pending changes; also copy your source code folder to some location temporarily, just to be safe (you can remove after you are all set)
go to Source Control Explorer
locate the "Workspace:" dropdown
select the item "Workspaces" from the dropdown list (you will get a dialog titled "Manage Workspaces"
if you have multiple Workspaces, select the appropriate one from the list in the dialog
click on "Edit" button (you will get an "Edit Workspace..." dialog)
down below in the dialog, you will see "Working folders" grid
click on appropriate row from the grid and modify the "Local folder" path to set to your new folder location
Sometimes TFS and Visual Studio have issues in getting these workspace changes synchronized. I would always close Visual Studio and re-launch it to get my changes synchronized anytime after I make Workspace related changes.
Hope this helps.
the most crude way here (I don't know if there is any other way)
is to put the folder back to its old location , Check in your changes
then remap the project to the new folder
When you move files/folders to make the moves pending changes you need to use a TFS client to do the moves.
For one or two files the Team Explorer UI is OK, for more the command line is easiest.
See tf.exe rename on MSDN (tf move is an alias for rename). There is also step by step help on using the GUI: Move, Rename, and Delete Version-Controlled Files and Folders.

Resources