When connecting to a project in TFS block local repo - tfs

In Visual Studio 2017, How do you connect to a TFVC project in TFS and prevent it from creating a local repo? I want to be able to copy files from another project in VS 2017 and check-in but not have all the files from that project local?

In the source control explorer, drill down to the project folder you want to add the files to, right click on the folder (you don't have to have it checked out) and click "Add items to Folder".
You should see an "Add to source control" dialog that is showing files from your local computer. From there, it's not too hard to follow.

When you connect to a TFVC project in TFS you could select to create local workspace or not. But we could not restrict users to create local repo or not.
If you do not want others to pull files from server to local, you need to use permissions to do the restriction.
You could directly copy files from another project to your local workspace, VS will auto detect changes and list in the pending change list. You just need to check in files.
More ways about how to add files to the server, please review this official tutorial.

Related

TFS not tracking changes if items added manually and not included into vs2015 solution

I've added a folder with asp.net core project which isn't supported by Visual Studio 2015 (which is used for everything else) and thus not included to the general solution.
To have those files in source control I had to manually add them using "add items to folder" command in source explorer. So they are checked-in but tfs not tracking changes for them anymore although there are differences that are shown if compare to the latest folder on the server:
How do I make TFS track them and show pending changes for edited files?
According to your description, looks like these files are all out side of Visual Studio.
Not sure if you are using server workspace or local workspace.
When adding or editing the workspace you click Advanced >> . There is a setting of Location: Local/Server.
For local workspace, when your script or anything else changes files outside Visual Studio, your workspace detects the changes automatically.
It also detects adds or deletes but you have to include them to your Pending Changes manually with the link under Excluded Changes.
For server workspace, you could choose to use Reconcile command. See https://stackoverflow.com/a/22860674/932282 for a complete answer.
Besides, you could also take a look at other solutions in below similar question:
How to have TFS 2010 detect changes done to files outside of Visual Studio?
Force TFS to detect changes
I think you just added them to source explorer and not to the solution, as you said. In this case, there is no editor application (even your VS) that is responsible for doing the check-out operation because they are not aware of TFS. On the other side, TFS can detect that changes have happened to the files but can not track them.
If you do not activate the "Get the latest version before check-out" option in your team project, then you can go to the source control and check-out those files manually and then check-in them manually again when your work with them is done.
Please before doing this, take a backup of your source code for caution.

TFS: How to view locally deleted files still under version control?

Say I have files under TFS source control.
Some external process will
Delete some of the files (A) in the local directory.
Add some files (B) to the local directory - files which should then be tracked in source control.
Modify some files (C).
Now I want to reflect all changes in TFS source repository, that is, I want to
Delete files A from source control.
Add files B to source control.
Update (check-in) files C.
B and C are trivial.
But i dont know how to easily see the list of files A. i.e. the ones that have been physically removed from the local directory but are still under source control.
How to view the list of them?
And is there a TFS command to delete them from source control?
Edit:
Forgot to precise: I'm using TFVC, with a local workspace.
Because is TFVC and I guess you work with server workspace you can't delete local file and it will appear in the Pending Changes. you must to delete it from the source control also.
Just right click on the file and "Delete", then check in.
If you have multiple files that you local deleted and you want easily get all of them and delete them, you can right click on the folder and then "Compare", in the popup click "Ok" and you will get the differences between your local folder and the server folder. then right click on the files and "Delete".
How to view the list of them?
Team Foundation Server requires that you explicitly pend changes for these files - if you delete a file locally, this does not explicitly pend a delete against Team Foundation Server.
To list the those files, the best method is create a local workspace and not a server Workspace. If we create the local workspace and delete the file out of Visual Studio, we will receive the list under the Excluded Changes of Pending Changes:
If you are using server Workspace, you have to delete those files in the source control. To list this change file, you could use Compare option in the Source Control Explorer:
Detail steps:
Open the Source Control Explorer
Right-click on the folder with the changes and choose Compare
Also, you can use "Reconcile" feature to sync those file to the local/server.
Check this thread for some details.
And is there a TFS command to delete them from source control?
We could use Delete Command to delete the file from source control, but we have to specify the identifies the file or folder. If you want to delete those files deleted out of Visual Studio, I am afraid we could not do that, because there is no such argument to list those changed files.
Hope this helps.

Can I check in code to another project in TFS 2013?

I'm writing code in a TFS 2013 Project. I'd like to check it into a different Project on the same server. Can I do this? Thanks
You can not directly check in the code to another project, you need to add the code file to another project first for source control, then check in the code changes.
In visual studio Team Explorer:
Connect To TFS project 1, configure the workspace and map source
code to local folder1. Open the folder1 in windows explorer.
Connect To project 2, configure the workspace and map source code to
local folder2. Open the folder2 in windows explorer.
Copy the code file which you want to check into another project (eg,
project 2 here ) from folder1 to folder2, then the system
will detected the new added files under Pending Changes >
Excluded changes.
Click the Detected link to Promote the new added files.
Check in the files to Project 2
Refer to these articles for more information : Add files to the server
and Check in your work to the team's codebase
UPDATE:
You can link to the WI in the same collection, but cannot link to the WI which in another collection.
That means, if the team projects are in the same collection, then you can link the WI (associate with the changeset) which belongs to another project directly.

TFS Server 2012 and Promoting changes

I started using TFS Team explorer 2012 and happen to notice a new process called promoting. As I understand it, the Team Explorer detect any changes made to the files outside of the TFS explorer and count them for promotion? Am I right?
How do I take care of the situation where I made a change to the file which is already checked out through TFS, then made a change via Windows Explorer\Notepad but dont want to include the changes made through the Windows Explorer\Notepad.
This is a new feature of TFS 2012 called Local Workspaces.
You are correct in that changes made outside of visual studio can be included in the check-in by promoting them, if they are not already under source control.
If they are already in source control and you do not want to commit them, then you would need to right click the file and choose Exclude. This will move the file from Included Changes into Excluded Changes.
If you do not like the new Local Workspaces you can tell TFS to go back to the old model of Server Workspaces:
Open Team Explorer
Go to Settings
Under Team Project Collection select Source Control
Click the Workspace Settings Tab
Here you can choose the workspace type.
While everything that discens said is correct, one thing bears explicit mention: there is no change to the level of granularity of Team Foundation Server. You still check out files and edit files and check-in files.
In your example, if you have a file checked out and you edit it in Notepad, the changes will be checked in. There is no change here from previous behaviors. There is no way to keep these changes from being checked in, short of saving the file with a different file name.

How to see changes in local working copy in TFS?

I'm an experienced SVN user getting used to TFS at a new client site. The main problem I've had adjusting to the new tool is this - how can I get a listing of all files in my working copy that have changed from current/latest server revision, including added or deleted files?
Essentially, I'm looking for the TFS equivalent of an "svn diff". The "TF" command-line tool has a "diff" command which reports changed files but I can't find an option to report deleted or added files; this missing feature has resulted in a couple check-ins which (embarrassingly) broke the build.
Which version of TFS?
TFS2010 has a folder compare command, File > Source Control > Compare... (or in the Source Control Explorer, right-click on the project path you're interested in, and select Compare...).
Set up the Source path to be a folder on the server and the Target path to be a local folder in your workspace (or vice versa). Under View Options, select Show items that exist only in source path, Show items that exist only in target path and Show items that are different and click OK.
Is there any reason you can't use the Source Control Explorer?
If you right click on the folder, project or branch you can click Compare and you will see all files that have been deleted or added.
I usually do the following:
Open your Team Explorer tab in Visual Studio and click on Pending Changes.
There you will see your changed files.

Resources