How to adapt Drag&Drop in VS Solution Explorer to correctly move in TFS - visual-studio

I'm looking to enhance the Visual Studio Solution Explorer. The problem I have is the following:
When I drag & drop a file in Solution Explorer it copies this file instead of moving it and in TFS this file is added instead of moved (rename)
Is it possible to intercept or add to the drag & drop functionality of the Visual Studio Solution Explorer so that I can call the required tf commands myself?

If the solution is already configured for integrated source control then the drag and drop functionality pends a rename operation in VS 2010 / TFS 2010.

Related

How can the Solution Explorer in Visual Studio Community 2019 be refreshed?

I have a basic c++ project in Visual Studio Community 2019. It contains three files: main.cpp, log.cpp, and log.h. I created a fourth file called Source.cpp and then deleted this file from the file explorer in Windows 10 to see how Visual Studio would adapt to external changes to files. Source.cpp is still visible in the solution explorer in Visual Studio.
I have tried unloading the project and reloading it but it still appears in the solution explorer. I assume it's best practice to delete files from within Visual Studio's solution explorer but there must be a way to refresh the solution explorer to reflect changes made outside of Visual Studio. Similarly, if I create a new file in the project directory (same directory as the other files in the project), it doesn't appear in the solution explorer. If I unload the project and reload the project, the new files is still not visible.
How can I refresh the solution explorer? My intention here is to better understand how Visual Studio organizes files in the solution explorer and how the organization relates to the actual file/directory structure in Windows.
After playing around with it for some time I realized that you can select the "Show All Files" button on the bar at the top of the Solution Explorer. This has a refresh button that works as expected (updates the Solution Explorer with the current state of the directory folder). It seems that files can be managed from this window and added/removed from the project in Visual Studio's default organization structure.

Is there a Command in Visual Studio for "Navigate to this item in TFS Source Explorer"

I want add a command to the R-Click context menu in the Solution Explorer that would navigate the TFS Source Explorer window to the right location corresponding to the item in question.
However I can't see how to do it simply without writing a VS extension, which I want to avoid at all costs.
It's not that I don't want extensions. I just don't want to write a custom one. Previously I'd be able to use macros but those were removed in these versions of Visual Studio.
The VSCommands extension will give you the option to locate a file in TFS and in the Solution Explorer
The Locate in TFS extension adds a context menu entry Locate in TFS to Solution Explorer and Open Tabs.

Sync Visual Studio folder/filename structure with file system structure/filenames

I've made a lot of changes (a.k.a refactoring) to my (big) visual studio solution and it appears now that vs solution structure is very different in visual studio from what it is on the disk and TFS.
Is there a way to make file system (and TFS) have the same folder names and file names as in visual studio solution with some tool or script/program/helper add-in?
This is the list of main issues:
- when I rename project visual studio does not rename folder where this project is located
- if I move project, file to different vs folder, it just happens in visual studio, but not on the disk
You can switch between logical or physical folders in the solution by clicking the "Show all files" icon (2nd top left icon in the solution pane). When not activated, you are viewing logical folders in the solution, drag and drop simply re arrange files virtually. When activated, you are viewing physical folders, drag and drop moves files on disk, using the source controller.
No there are no tools that can help you do this automatically.
There is a two step approach to solve it, made easier by installing two add-ons. I prefer to use the Team Foundation Power Tools and the Source Control Explorer Extensions.
From the Source Control Window inside Visual Studio:
Close the open solution in Visual Studio
open the Source Control window in TFS
Move the folders around to match the structure you prefer, with the mentioned add-ons you should be able to drag/drop and rename them more easily
Alternatively, do the changes on file system with the Team Foundation Power Tools explorer extensions installed:
Close the solution in Visual Studio
navigate to your workspace folder using Windows Explorer
use the TFS context menu on the folders to check-out/rename/move the items ans folders
Then re-load the solution in Visual Studio and:
Open the solution and see that a lot of projects don't load.
Highlight a project that couldn't be found
On the project properties window (ctrl-w, p) find the file path item and click the little [...] button to navigate to the new project file location for each project.
Rightclick the projects you've updated this way in the solution explorer and reload them
Rebuild your solution to verify all changes went as expected
Check-in your changes

How to jump to a file in the Source Control Explorer in Visual Studio

I love the Solution Explorer > Right-click > "Open Containing Folder" feature of the PowerCommands extension for Visual Studio 2010. I want the equivalent of a "Jump to location in Source Control Explorer" feature. How can I find out the location in TFS of a given open file, or a file in the solution explorer (or a file in the solution navigator in you have the Productivity Power Tools extension)?
The best answer would be a couple of mouse clicks and no keyboard. Next best answer would be a hotkey mapping.
The only solution that I have found so far is to use the Productivity Power Tools extension which has the feature "Find in Source Control". A file in the results list can be right-clicked to "Open folder in Source Control Explorer". The drawbacks to this solution is that is takes many clicks, and the search results can match more than one file if files exist with the same name in different folders.
There is a stand-alone extension that you can download, called Locate in TFS, within Visual Studio.
"Locate in TFS" on TFS Gallery
"Locate in TFS" on GitHub
This also works on files that you "Exclude from source control", as many developers do with the web.config files.
psulek's post, above, mentions this as part of VSCommands, but I prefer the stand-alone extension.
Try Visual Studio extension VSCommands for Visual Studio 2012. It has feature called Locate in TFS. This will add new button to Solution Explorer Locate in TFS which opens active selected file/folder in TFS Source Control Explorer.
Feature request has been raised with Visual Studio team. Read here
I know it's probably too late. See TfsExt extension for vs2010
I'm not sure if it's possible, but it's a good suggestion.
These two examples show how to use the Visual Studio Extensibility APIs to access the TFS Source Control Explorer APIs.
http://blogs.msdn.com/b/edhintz/archive/2006/02/03/524312.aspx
http://blogs.msdn.com/b/bharry/archive/2008/07/09/working-on-tfs-sdk-improvements.aspx
For Visual Studio 2013 try lightweight extension TfsExt13

File Drag & Drop ability in Visual Studio

I was wondering if any one knew of a plug-in or a way to:
I would like to be able to drag files from Solution Explorer to a Windows Explorer window and have the file copied to the location in Explorer.
Currently using VS2005
See VS Explorer - an addin which adds a file and folder browsing window to Visual Studio. It allows you to drag-drop files from Solution Explorer to external folders, vice versa and more.

Resources