TFS View History in VS2010 for all files under a Solution - visual-studio-2010

I'm trying to view history in Visual Studio 2010 for all files included in a given Solution file via the Solution Explorer View. I use TFS 2010 for source control, and I'm aware that I can get history for a folder recursively in Source Control Explorer. My issue is that we have multiple projects in a root directory, all of which are included in a variety of solution files in that same directory (each solution file represents a deploy-able component, including some "shared code" between them). I just want to view history on all of the files included in a given solution file, and not everything in this root directory. When I right click on a solution or project in Solution Explorer and "View History", I just get history for that solution file or project file, nothing more.

Alas, this cannot be done with TFS as it is.
TFS Source control does not know if a file is a solution file or a text document. It just stores it for you. There is no parsing at all. I can (and do) store Delphi project files in TFS. There is no way for TFS to be able to understand and be smart about every file type that exists.
It would be nice if Solution explorer did this for you (as it is specific to your project). But it does not.
You could create a custom plugin to TFS and Visual Studio to do what you are asking, but it would probably take longer than just manually checking the history of all the files in your solution.

This might help, it's an add-in extension
VS 2010 and VS 2012

Related

Organizing project files in Visual Studio for better explorer view

I have a project in visual studio where there are several files arranged in folders (filters). Inside the project, everything is well organized, but as soon as I go to the explorer, I see that all the project files are in the same folder. How can I properly organize my project so that the repository doesn't look like a bunch of files in one folder?
I use Visual Studio 2022
I tried to manually decompose the files into folders, but when I did this, visual studio began to swear that it could not find the files
Can you share a screenshot of what you have and what you want?
I ask because there are two aspects to this.
The arrangement of projects within Solution Explorer
The arrangement of files within projects within Solution Explorer
The first can be controlled by adding solution folders. The structure is stored within the .sln file.
The second is generally a representation of the file system, depending upon your project type.
Also, make sure you're using the Solution Explorer view. Does this button appear clicked for you?
If so, you should unclick it. Solution Explorer can show you either the solution view (default, and what I refer to above) or the file system view.

Finding which solution a file belongs to in Visual Studio

I am using Visual Studio 2010 and somehow the people who created this project have a folder which contains files for multiple projects in a single solution.
Is there a way to find in which project in the solution explorer a file is included ?
Outside of Solution Explorer, you can use a utility like WinGrep to search all .csproj files (or if not using c#, whatever extension for your project files).
I do that type of thing all the time. A project file is really just a text file that can be searched like any other text file.
Since then I found that Microsoft Productivity Power Tools does this. When installing it you get a 'Solution Navigator' in the 'Solution Explorer' tab which allows you to search files and it will display to which project it belongs.
Download

Rename project folder in Visual studio and Team foundation server

My Visual Studio 2013 solution has a project "Test". I can rename it in solution explorer, but I also want to rename the project folder in disk and also reflect the change in Source Control(TFS). How can I easily do this?
Thank you
#CodeCaster, Thank you. Based on your advice, I have done some quick experiment, and worked it out. First step is rename the folder name in TFS; the new folder will appear in local workspace and all contents of the folder moved to this new folder. The old folder stays there with rest content which not belong to source control. You can delete it manually.
Or
Using TFS Power Tools to rename from Explorer.
I followed those steps to preserve the version history of the files inside of TFS:
Rename/move project file (.csproj) in source control explorer in VS (alternatively, this also works from within VS Solution explorer, simply select "rename")
Rename/move project folder in source control explorer in VS
now the project should be unavailable in VS, solution also gets closed
remove project from VS
add project (new path) to VS
fix project references in other projects
adjust namespaces if desired
adjust assembly name and default namespace in project settings
Don't know of an easier way. Was searching for this myself, and this should be the way to go.
I think you can rename it from the TFS Database.
Try going into tbl_Project of the Tfs_DefaultCollection Database, which you can find on the SQL Server Instance used by tfs. You can know which one is that by going into the TFS Console, click on Application Tier, then find the details of the Server under the Data Tier Summary. Run an update query against the project you want to rename.. I haven't tested this but just assuming it should work (some educated guess)..
I am using TFS 2015 Express and rename project is grayed out.
You can still rename the project using the TFS Site for the project.
Here is a link that shows how to do it.
https://www.visualstudio.com/en-us/docs/setup-admin/rename-team-project
I was facing a similar issue while trying to rename a folder in Visual Studio 2015.This is what I tried.
Right click on the project file
Open with Notepad
This will generate your current solution file
Change the occurences of your prev file name. (Find and Replace with the desired name)
Save it and close
Change solution explorer name and rename the folder to your desired name.
This should work.

Dll dependencies on a Visual Studio 2010 solution and TFS

How can I make a solution in visual studio so that the .dll dependencies that reside in some other directory totally different from where the solution itself is affected by "get latest".
What I've tried is creating a Dependencies solution folder within the solution itself and added the dlls to it, that way they belong to the solution even though they don't belong to the directory structure of the solution.
So for example the .sln file is in:
D:\tfs\repository\main\SolutionA\solution.sln
and the dlls are in:
d:\tfs\repository\main\SolutionX\Dependencies\Binaries
What I really want to achieve is to have a foolproof way to build the solution, including the following scenario:
1- Have a brand new installation of windows, visual studio, etc.
2- open visual studio
3- find solution.sln on TFS, double click on it so that visual studio gets every project and files in the solution, and opens the solution
4- successfully build
What happens when I try the Dependencies solution folder approach and repeat the scenario above, it will get all the projects within the solution, opens it, but the dependencies solution contents won't be pulled from TFS (although Visual Studio shows them on Solution explorer), which I think is flawed.
Some suggestions that don't involve creating pre/post build scripts are appreciated.
When you attempt to open a solution for the first time using the TFS Source Control Explorer, you may find that not all of your dependencies will be retrieved - the squiggly line may be highlighting some of your missing References.
One work around is to...
SOLUTION SETUP
Checkout all of your source code from TFS (i.e. Main and all of the sub-directories)
Open your solution in Visual Studio (i.e. MyApplication.sln)
In the solution explorer, create a New Solution Folder called ThirdPartyDll, and then add the appropriate assembly references (i.e. Assembly1.dll, Assembly2.dll,...)
Check-in your solution to TFS
SAMPLE FILE STRUCTURE
Main
MyApplication.sln
Source
MyProjectA
MyProjectA.csproj
MyProjectB
MyProjectB.csproj
Dependencies
Assembly1.dll
Assembly2.dll
You've run into a limitation of the "Open from Source Control" functionality. If you added the solution to source control from Visual Studio you should have seen the following message:
"The project that you are attempting to add to source control may cause other source control users to have difficulty opening this solution or getting newer versions of it. To avoid this problem, add the project from a location below the binding root of the other source controlled projects in the solution."
Open from Source Control will create a workspace mapping for the solutions root directory (D:\tfs\repository\main\SolutionA) but not a separate one for the SolutionX folder which is a peer to SolutionA. On the "new" machine you will need to manually create a workspace mapping to d:\tfs\repository\main in order to get both the SolutionA and SolutionX folder.
Create a solution folder and add the dependencies to it, that way when VS gets latest for the solution it will download these files. A bit brittle as people will need to maintain that folder but it works.
Alternatively create a nuget package and use restore packages on build. It will require a couple of extra steps when you create a new developer box (your nuget package repo will need to be added) but it will work for all projects going forward and is less brittle than the solution folder method.

Create a physical copy of a source file in Visual Studio

In Visual Studio, if I try to copy a file from one project to another (by using Copy and Paste or by dragging the file to the new project while holding the Ctrl key) it creates a reference to the source file in the original location. Is there a way to create a physical copy of the source file and place that in the target project source direction without having to resort to using Windows Explorer to copy the file manually?
It's not pretty, but when I want to do what you're suggesting, I double-click on the file in Visual Studio, which opens it. Then I do a File->Save As, choose the right directory and save it. All from within Visual Studio. This is usually followed by adding the new file to the other project.
Was just doing this and realized I should mention a side-effect. Depending on your source control (in my case, TFS 2010), doing this from within Visual Studio may modify the location of the file in the project. For me, this means making sure that neither the file nor its project have any pending changes, doing the save as, then doing an undo of the change this causes in TFS 2010 (project change, file add and delete).
From http://msdn.microsoft.com/en-us/library/0fb6xxhb.aspx:
If you are working with solution items, Visual C++ projects, or other similar projects, you are always working with links in Solution Explorer. If you are working with Visual Basic projects, Visual C# projects, and other projects, you might be working with links or files.
Essentially, the answer to my question is 'No'. In most cases, I must use Windows Explorer.

Resources