"You have to learn why things work on a starship." -- Capt. Kirk (ST II - The Wrath of Khan)
Welcome to MSDN Blogs Sign in | Join | Help
Using TFS 2008 Power Tools to modify server's offline state

Normally to reset your client's view of a TFS server from Offline to Online, you would 'Go Online' with a solution bound to that server.  The server's offline state is reset as part of this operation.  If you want to manually mark your server as Online (or Offline), you can modify the Offline and AuoReconnect registry key values mentioned in: http://blogs.msdn.com/benryan/archive/2007/12/12/when-and-how-does-my-solution-go-offline.aspx.   I

f you want to avoid directly modifying the registry, there is now a UI available to update the values.  This UI is the 'tfpt tweakui' command found in the Visual Studio Team System 2008 Team Foundation Server Power Tools (available at: http://msdn.microsoft.com/en-us/tfs2008/bb980963.aspx). 

To use tweakui to modify your server's offline state simply select your server in the list view, click the Edit button and set the states of the "Auto reconnect this server on startup" and "Server is offline" checkboxes.

Manually taking your server offline could be useful if you are pulling your client machine off the network and want to work offline without waiting for a solution to discover its offline state by timing out its server connection attempt.  Manually taking your server online has the marginal benefit of having your next attempt to open a solution prompt you during the open to take the solution online as opposed to having to manually choosing the Go Online menu option or toolbar button after the solution has opened.

by benryan | 1 Comments

How to make TFS Offline strictly solution-based

For some users it may be a bit offputting that taking one solution offline causes all other solutions bound to that same server to go offline when they are opened (assuming no "Go Online" operations in the interim).  There is a registry key value that may be specified to tell VS to ignore the server-based Offline setting and to only utilize the per-solution Offline setting.

To turn off server-based offline support:

  1. Go to the registry (e.g. regedit)
  2. Add a string value named, IgnoreServerBasedOfflineFlags, under 
    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\SourceControl
  3. Set the value to "True".

NOTE: My original text for this blog entry had stated that you set the value to "False" in step 3.  Obviously, this was incorrect.  Sorry for the confusion.

by benryan | 8 Comments

When and how does my solution go "offline"?

TFS 2008 adds improved support for "offline" scenarios.  This blog post identifies the scenarios under which a solution will be placed in "offline" mode.

  1. If the Visual Studio IDE is unable to connect to the TFS server when it is opening the solution, then it will mark the solution as being offline.  It will also mark the TFS server as being offline.

    A messagebox will be displayed indicating the solution was taken offline and a message to the same effect will appear in the Output window.

    -OR-
  2. If the Visual Studio IDE is opening a solution and finds the TFS server to which the solution is bound is marked as offline, then VS will mark the solution as being offline

    In this scenario, a message about the solution being opened offline will appear in the Output window, but no messagebox will appear.

 

NOTES

  • Offline detection is done ONLY during solution open.  Failures to connect to the server during other version control operations within VS do not affect the offline state of the solution or server.
     
  • The offline state for the solution is stored in the solution's local .suo file.
  • When the server is marked offline, we also turn off the server's "AutoReconnect" setting.
  • The server's offline state is stored in a registry value named Offline, and the AutoReconnect state is stored in in a value named AutoReconnect.  Both of these live under the key:
    HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\TeamFoundation\Servers\<tfs server name>
  • A solution remains offline until it is explicitly taken online.
  • A TFS server remains marked offline until an offline solution bound to that server is taken online.
  • Opening a solution that was previously marked offline while its server is still marked offline opens the solution without any messageboxes appearing.  We will present a message in the Output window indicating the solution is still offline.
  • Opening a solution that was previously marked offline when its server is marked online presents the user with a messagebox asking if the user wishes to take the solution online.

 

 

by benryan | 9 Comments

Get Latest on Checkout depends on a TFS 2008 server

It is worth noting that the "Get Latest on Checkout" feature requires server support to function.  In other words, you must connect to a TFS 2008 (or later) server for Get Latest on Checkout to work.  There has been some confusion in the forums because the Get Latest on Checkout option appears to be configurable on the client even when connected to a TFS 2005 server.  It is unfortunate that we do not disable the Get Latest on Checkout configuration options under Tools->Options->Source Control and under the Team Project settings in this case, but these options are meaningless if you are not connected to a TFS 2008 server.

by benryan | 1 Comments

Integrating TFS with Visual InterDev (and why it does not work)

This topic comes up quite often, so I thought I would write a blog entry.  For the most part this is basically a rehash of my posting to a forum thread a year ago.  See: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=275481&SiteID=1.

Technically, TFS integrates with Visual InterDev by using the TFS MSSCCI provider.  In reality this is less than useful.  InterDev only uses the MSSCCI interface to source control some local artifacts.  Your website is being placed under source control by the IIS server to which it is published.  As part of using FrontPage Server Extensions (FPSE) to publish your website to IIS, InterDev also uses FPSE to forward source control operations intended for the website to the IIS server.  Here is where the problem occurs.  The FPSE engine within IIS DOES NOT USE MSSCCI for source control!  Instead, FPSE in IIS uses a direct OLE connection to the Visual SourceSafe installation that is local to the IIS server (see: http://www.codeproject.com/asp/VSS_and_VID.asp for more information).  Therefore, the fact that InterDev is configured to use the TFS MSSCCI plugin has no effect on how the website is actually put under source control since this happens at the IIS server.  Furthermore, it is not possible to configure the IIS server to utilize Team Foundation Version Control.  There currently are no plans of which I am aware that call for adding TFS integration to FPSE within IIS.  At present, if you use InterDev and FPSE for your website then you must use Visual SourceSafe as the repository.

by benryan | 0 Comments

An override for "Get Latest on Checkout"

In the course of working on the improved offline experience for Orcas, we discovered that going online with Get Latest On Checkout turned on was rather painful.  Specifically, you would never get a chance to generate a version conflict.  This, in turn, meant you would not be offered an opportunity to merge your "offline" local changes with the server if there was a newer version on the server when you went online.  This is due to the fact that you pended the edit against the tip version of the file, so all conflict generation regards you as being at tip.

To get around this difficulty, we decided to update our API and add a new flag to the PendChangesOptions parameter in Workspace.PendEdit.  This flag is, ForceCheckOutLocalVersion, and it will cause "GetLatestOnCheckout" to be bypassed for this PendEdit call.  The PendEdit call is forced to pend an edit against the version of the file that is present locally in your workspace regardless of whether the client or team project "GetLatestOnCheckout" setting is active. 

The ForceCheckOutLocalVersion flag did not make it into the Orcas Beta1 release, but it should be available in a later release.

by benryan | 1 Comments

A Refresher on "Refresh"

When dealing with forum posts about SCC issues, many respondents will suggest that the user perform a “refresh” to see if this remedies the problem.  While this is often good advice, the term refresh has some ambiguity due to the number of refresh options available.

  1. Refresh via Solution Explorer toolbar button
    This mechanism sends an event back to the currently selected (in Solution Explorer) project or projects notifying them to refresh.  Different project systems may take different actions when presented with a “refresh” event.  For instance, directory-based web projects will scan the local web project directory looking for added or removed files and will then update the Solution Explorer view.

    Most projects will query the SCC provider to reacquire the SCC glyphs presented in Solution Explorer.  However, this query does not refresh (i.e. reacquire) any SCC status.

    Because this operation does not refresh SCC status, it is typically not helpful when trying to resolve situations where the IDE’s SCC state is inconsistent with respect to the SCC server.
  2. Refresh via File->Source Control->Refresh Status
    This mechanism sends a notification directly to the SCC provider and causes it to contact the server to refresh both the current pending change information and the SCC status for the item(s) selected in Solution Explorer.   

    It is important to note that the operation is scoped to the current Solution Explorer selection.  Typically one will ensure that the solution is selected prior to issuing this refresh operation to ensure all items refresh.

    Once this operation completes the Solution Explorer and Pending Changes toolwindows should be up-to-date.  This is usually what is meant when someone suggests performing a refresh to resolve an SCC issue.
  3. Refresh via Pending Changes toolbar button
    In VS 2005, the Refresh toolbar button in the Pending Changes toolwindow performs identically to the File->Source Control->Refresh Status operation as discussed in item #2.  This includes scoping the operation to the current Solution Explorer selection, so be sure you have the intended target selected (e.g. the solution node).

    In the Orcas release of VS and TFS, the Pending Changes "Refresh" button is slated to change to always scope the Refresh to the entire solution.  The File->Source Control->Refresh Status operation will remain scoped to the Solution Explorer selection.
  4. Refresh via Source Control Explorer toolbar button
    This operation will notify the SCC provider to contact the SCC server and refresh the status for all of the expanded (e..g viewable) nodes in the Source Control Explorer treeview and listview.  The listview and treeview are then updated using the newly acquired data.  Obviously, this Refresh operation is most helpful in situations where the Source Control Explorer is out-of-sync instead of Solution Explorer.

by benryan | 0 Comments

How to make a project compatible with VS source control integration

The following are the necessary mininum steps required to integrate a new project type with source control within Visual Studio.

  1. The project must implement Microsoft.VisualStudio.Shell.Interop.IVsSccProject2 (documentation).
    • GetSccFiles - return which files are controllable for the given item ID
    • GetSccSpecialFiles - return hidden files for the given item ID
    • SetSccLocation - persist the SCC settings to the project file
    • SccGlyphChange - notifies project that changes have been made to the indicated items' SCC glyphs
  2. The project must utilize Microsoft.VisualStudio.Shell.Interop.IVsSccManager2 (documentation).
    • RegisterSccProject - call when the project is opened
    • UnregisterSccProject - call when the project is closed
    • GetSccGlyphs - call to get source control glyphs and source control status
  3. The project must utilize Microsoft.VisualStudio.Shell.Interop.IVsQueryEditQuerySave2 (documentation).
    • QueryEditFiles - call before editing a file in the project to notify listeners (e.g. SCC)
    • QuerySaveFiles - call before saving a file in the project to notify listeners (e.g. SCC)
  4. The project must utilize Microsoft.VisualStudio.Shell.Interop.IVsTrackProjectDocuments2 (documentation)
    • OnQuery* - call before attempting the add/rename/move/etc. operation to notify listeners (e.g. SCC) and to give listeners the chance to veto the attempt.
    • OnAfter* - call after the operation has been performed to permit listeners (e.g. SCC) to perform related operations (e.g. pend an SCC add).
  5. To permit SCC commands to show in the context menus, the menu should contain the following groups:
    • guidSHLMainMenu::IDG_VS_CTXT_SOLUTION_SCC
    • guidSHLMainMenu::IDG_VS_CTXT_PROJECT_SCC
    • guidSHLMainMenu::IDG_VS_CTXT_ITEM_SCC

by benryan | 0 Comments

Get Latest on Checkout
At the end of November my crew wrapped up our work on the Get Latest on Checkout feature and checked it into the Orcas sourcebase.  This feature is obviously targetted at users who are more comfortable with the Visual SourceSafe model of exclusive locking combined with Get Latest on Checkout.  Note that the TFS Get Latest on Checkout does not implicitly turn on exclusive locking; you will need to do that explicitly.  Details about this feature and others our group has been working on for Orcas can be found at Feature Specifications for Visual Studio and .NET Framework "Orcas" on MSDN.

by benryan | 1 Comments

Version 1.2 of TFS MSSCCI Provider Released
We have released an update to the TFS MSSCCI Provider.  An indepth description of the new features and bug fixes can be found in Michal Malecki's blog posting.

by benryan | 0 Comments

Introduction

About Me 
My name is Ben Ryan, and I have been involved with developing the Team Foundation Server version control client for the last three and a half years here at the Microsoft office in Durham, NC.  During most of that time, I have been working on the low level source control integration of Team Foundation Server within Visual Studio.  As time allows, I assist my coworker, Michal Malecki (http://blogs.msdn.com/michalma), with the TFS MSSCCI PlugIn. 

I have 14 years of software development experience that span several companies and numerous software projects.  My previous employers include:

  1. Ateb - C development on Linux-based signature capture appliance
  2. Alerts.com - Java development of a distributed messaging service
  3. HAHT - Integration of Java VM within native Windows and UNIX HAHTsite server application
  4. Data General (now part of EMC) - C development within DG/UX kernel's TCP/IP protocol stack

This list is not all inclusive, but it does offer a representative sampling of my background.

Blogging Topics
For starters, I intend to blog about Visual Studio source control integration.  Ideally, I'll cover both what is involved with making a new project type compatible with integrated source control and how a source control provider interacts with Visual Studio.  Hopefully, the latter discussions will provide some insight into how TFS operates within Visual Studio and why it operates that way.

After that, I'm not sure what I'll blog about.  I'm not too concerned given that the mysteries of the source control integration layer should provide me with blogging fodder for months to come.

by benryan | 0 Comments

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker