Click here to Skip to main content
Licence CPOL
First Posted 8 Sep 2007
Views 25,000
Downloads 149
Bookmarked 9 times

TFS: Check Out - Get Latest

By | 8 Sep 2007 | Article
Addin for Visual Studio 2005 to prompt user to get the latest version before checking out a file for edit

Introduction

This project allows TFS users the ability to get the latest version before editing a file upon check-out. Based on the code started here, this project adds two things. One is the prompt - It asks the user if she/he wants to get the latest version (not always do they want to do this - They may be editing an earlier version on purpose). The second change is that the original requires the developer to modify the devenv.exe.config file to add the TFS server information. This project detects the currently connected server/project and uses that information.

Using the Code

The important changes come in the TFSAccess class. Notice below that the server is detected and when a change occurs, that is also detected.

internal TFSAccess(DTE2 applicationObject)
{
  _TFSExt = applicationObject.GetObject
		("Microsoft.VisualStudio.TeamFoundation.TeamFoundationServerExt") 
		as TeamFoundationServerExt;
  if (_TFSExt != null)
  {
    if (_TFSExt.ActiveProjectContext.ProjectName == null)
    {
      _TFSExt.ProjectContextChanged += 
		new EventHandler(this._TFSExt_ProjectContextChanged);
    }
    else
    {
      _previousDomainName = _TFSExt.ActiveProjectContext.DomainName;
      Connect();
    }
  }
}

private void _TFSExt_ProjectContextChanged(object sender, EventArgs e)
{
  if (_TFSExt != null && _TFSExt.ActiveProjectContext != null && 
			_TFSExt.ActiveProjectContext.DomainUri != null)
  {
    if (_previousDomainName != _TFSExt.ActiveProjectContext.DomainName)
    {
      Connect();
      this.OnConnectToTFS(new EventArgs());
    }
  }
  _previousDomainName = _TFSExt.ActiveProjectContext.DomainName;
}

History

  • 8th September, 2007: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

ghmcadams

Software Developer (Senior)

United States United States

Member

Gabriel McAdams is a longtime .NET developer. He has specialized in ASP.NET and Web Services. Gabriel mostly develops using: C# ASP.NET Web Applications and Web Services SQL Server 2005/2008 - but over the course of over 10 years as a developer has used a lot of other technologies!

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralCannot check-in file which were replaced to latest version by plugin PinmemberTRVQ20:06 24 Jul '09  
GeneralRe: Cannot check-in file which were replaced to latest version by plugin Pinmemberghmcadams5:29 24 Jul '09  
GeneralRe: Cannot check-in file which were replaced to latest version by plugin PinmemberTRVQ223:19 27 Jul '09  
Questionerror? PinmemberColinBashBash11:28 9 Sep '08  
AnswerRe: error? Pinmemberghmcadams8:18 10 Sep '08  
GeneralRe: error? PinmemberColinBashBash10:39 29 Sep '08  
GeneralUnable to Connect TFS PinmemberThulasi Rao19:44 26 May '08  
GeneralRe: Unable to Connect TFS Pinmemberghmcadams8:20 10 Sep '08  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 8 Sep 2007
Article Copyright 2007 by ghmcadams
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid