How can I create an extension for Visual Studio that can interface with TFS directly? - visual-studio

I am attempting to create an extension that will periodically check to see if the user has the latest version of all files in a specific project or branch. This specific project/branch is going to be determined by what item is checked out for editing. The reason for creating this extension is to create reminders every time a file becomes unsynced. This will prevent merging into items that are out of date.
I am also working with Gated Check-ins, so it would be advantageous if I could check for latest version after a gated build succeeds.
I am having trouble finding the APIs for TFS integration when making an extension for visual studio. I am also having trouble finding an API to use to make a direct TFS extension. I am assuming this is because everything that has to do with TFS commands should be done using TFS command line commands.
I am running TFS and VS 2015.
Thanks in advance for the help!

You can use NuGet packages of TFS API:
Microsoft.VisualStudio.Services.Client
Microsoft.TeamFoundationServer.Client
Microsoft.TeamFoundationServer.ExtendedClient
All the DLL's also stored in the following location, you can take them and use in your project:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer
A good tutorial on how to use the API you can find here.

Related

Force extension installation in Visual Studio

We're working in quite a large project and is having a hard time getting people to configure their Visual Studio correct (tabs instead of spaces etc.). We found a great solution in using the EditorConfig extension for Visual Studio.
However there are still some developers that seems to ignore our request to install this extension to their Visual Studio and hence I'm wondering if there is any way to force an extension to be installed before a solution can be opened, maybe some setting in the .sln file?
No there is no such option built-in. If your machines are domain joined, you could push out the installer through System Center or domain logon scripts.
You could cheat and create a solution level pre-build step. Create a target file named: before.{solutionname.sln}.targets and store it next to your solution file. Check it into source control. In the targets file you can use standard MsBuild to see if the extension is installed (you'll need to check the file system probably) and if not present force the installation by calling vsixinstaller.exe to trigger the install.

How to determine who is using/modifying file in VisualSVN?

Recently I have intalled VisualSVN and TortoiseSVN extensions in my Visual Studio 2015. I have successfully configured Repository and now it is working fine.
I have also configured svn:needs-lock property to my pages. Now, I need to know who is modifying or using the particular file and which is supposed to be committed.
The problem is that there may be multiple developers might be modifying multiple files and Now, I need a list of files which is exclusively checked out by developers. Just like a Pending Changes Explorer in Visual Studio for whole repository. So, where can I get a list of files which are being used same as Visual Source Safe Control?
If you need any information just ask me in comment I will add it.
Thanks!!

How to remove a file from Visual Studio Online and its history

We are very new to using Visual Studio Online. After some discussion we have decided to not keep our web.config files in the cloud. It was easy enough to remove it from the project, however, the file still exists in the changesets and history. Is there a way to wipe it from the cloud either through the website or visual studio? We are using 2015. Thanks.
EDIT We are using Team Foundation Version Control.
Destroy Command (Team Foundation Version Control).
You need to destroy the file you want and then you will have to commit to save the changes. With this the file and it's entire history will be deleted. See if this helps.

TFS - Checkout File from Outside Visual Studio - Offline Mode

i have used TF.exe (Team Foundation Client) to checkout files from outside with the following command.
http://blogs.msdn.com/b/noahc/archive/2007/01/22/real-tfs-command-line-help.aspx
tf checkout $project/filename
but, i need to checkout from outside when TFS server is also not reachable. In visual studio, it prompts us to work offline and then later on, it sync automatically with the changes into server when it goes online. How do i acheive the same from tf.exe or any other way to do it.
PS: i do have real requirement of editing some files which is not belongs solution files which gets modified from outside of visual studio. as of now,i am using tf checkout method to checkout the file from outside. but, this require connection TFS server all the time.
You can't do this with the command-line tools, because the offline mode is a feature of Visual Studio, not of TFS.
The tools always work directly with the TFS, so it must be online and reachable at that time.
Amendment regarding your P.S.: What Visual Studio does in Offline mode is just setting the local files to writable and "remembering" with which files it did that. Then, on going online again, it checks for any changes in the meantime. If there were any, it starts a merge process, if there weren't, it checks out the file without getting it.
There's no reason why you couldn't do this same process by hand, it's just more comfortable through VS.
BTW: Why not have a Solution for this "dangling files"? Just create an emtpy solution and add them as Solution Items. This way you can use the VS offline mode.

Project management with Visual Studio, without TFS?

Can I have some basic project management in Visual Studion without TFS or is TFS what I need?
Basically I like to get a list with my projects, last edited dates, and if possible project tags (customer for example), and when selecting one VS should load it. From the right repository (Mercurial/Git/Svn). I can move my project to some repo host if they have this solution (Addon).
At the moment I handle the projecs manually with Windows standard folders + SVN/Hg in folder context menu, and thats a headache.
Thank you
As far as I know Visual Studio doesn't support that functionality natively.
TFS isn't my forte but I know it comes with MSDN subscriptions and the retail version is around $500 if that is the path you are interested in. If you do go the TFS route you have an option to use TFS Basic during install which is a greatly simplified install of TFS that can even use SQL Express.
You can check out pricing and download the trial from here if you want more info:
http://www.microsoft.com/visualstudio/en-us/products/2010-editions/team-foundation-server

Resources