Create checkin policy for TFS 2010 that works with VisualStudio 2008


  • We are moving from VSS to TFS 2010. However, we are still using Visual Studio 2008. My problem is how do I create a checkin policy for TFS 2010 that has to work under Visual Studio 2008.

    I have tried the following without success:

    1) Write the policy using Visual Studio 2010

    - it works fine of course under Visual Studio 2010 and Team Explorer 2010

    - it cannot load under Visual Studio 2008

    2) Write the policy using Visual Studio 2008

    - cannot get it to work at all under Visual Studio 2008, 2010, nor Team Explorer 2010.

    Anyone has any insights on how to get this to work or whether this is possible at all.


    giovedì 26 maggio 2011 18:58

Tutte le risposte

  • Hi Digitalboy2,

    Thanks for your post!

    There is a similar issue which is submit to our site:

    It's a issue about VS 2008 TFS CheckIn Policies fail to load with VS 2010. I hope it can help you.

    Best Regards,

    Cathy Kong [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    venerdì 27 maggio 2011 09:41
  • Thanks for the link. I did look at that issue before. I tried the workaround suggested to no avail.

    My issue is different because I want to connect to TFS 2010 Server from a Visual Studio 2008 client.

    lunedì 30 maggio 2011 17:24
  • Hi Guys!


    So, I've been facing exactly the same problem as you....I've a check-in policies already installed on TFS 2010 and everything working successfully..anyway, when I try to use it thru TFS 2008 it returns me an error... :(


    Any news?


    Best Regards!

    giovedì 4 agosto 2011 13:39
  • Here is how I got it to work:

    1) Create the project for the checkin policy in Visual Studio 2008 (not in 2010)

    - I reference the following assemblies:

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.dll

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Client.dll

    C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Client.dll

    2) In the policy code, if you need to connect to TFS Server, you have to use the old way of connecting to TFS Server (not TfsTeamProjectCollection); I do the following:

    TeamFoundationServer TfsServer = new TeamFoundationServer(TFS_SERVER_URI);

    3) Create a setup project in the same solution and have it write the following registry keys:

    HKLM\Software\Microsoft\VisualStudio\10.0\TeamFoundation\SourceControl\Checkin Policies


    HKLM\Software\Microsoft\VisualStudio\9.0\TeamFoundation\SourceControl\Checkin Policies


    4) At this point when you build and deploy the policy, it should work with Visual Studio 2008

    5) After you confirm (4), you can make it work with Visual Studio 2010, by modifying the devenv.exe.config for Visual Studio 2010:

    C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config

    Add the following XML to the file to redirect the assembly bindings from 9.0 to 10.0:

    <assemblyIdentity name="Microsoft.TeamFoundation.WorkItemTracking.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="Microsoft.TeamFoundation.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="Microsoft.TeamFoundation.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Client" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="" newVersion=""/>
    <assemblyIdentity name="Microsoft.TeamFoundation.VersionControl.Common" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="" newVersion=""/>


    giovedì 4 agosto 2011 16:11
  • For Dev 11: I got it to successfully load the ChangeSetComments policy the others have a lot more dependencies that need to be redirected. I haven't experimented yet which versions need to be redirected to which versions, but it should be doable to get them to work as well.

    I registered them in the 11.0_Config hyve in the registry under HKCU.

    My blog:

    lunedì 5 marzo 2012 14:23
  • The story for VS 2008 / VS 2010 check-in interoperability is not good, as you've noticed. The good news is that we are making improvements in this area. For those customers that plan to have a mixed installation of VS 2010 with VS 11, we have improved the compatibility story for our own in-box check-in policies. The methods we used to make them play nicely together can be used by customers (you!) for their own check-in policies, too. It's a technique that we'll look to put into a detailed blog post as the release date for VS 11 gets closer.
    mercoledì 7 marzo 2012 01:08
  • Awesome.  We have a lot of custom check-in policies at my company and a few of us have moved to VS 11 Beta, and it's a real pain not having the policies work and constantly getting errors about them.  We won't be moving all of our developers onto VS 11 Beta until we can get this issue resolved.  I look forward to that post showing how to upgrade the 2010 check-in policies to get them working in VS 11 Beta.  Thanks.

    - Dan - "Can't never could do anything"

    martedì 27 marzo 2012 21:21
  • Dan,

    Here you go:

    Any comments or findings, please reply to the post or contact me by email twitter or other means. I'm trying to piece together a number of workarounds to make to co-existence of VS2010 and vs11 on a TFS11 or TFS2010 server go as smooth as possible. The API has changed a lot between TFS2008 and TFS2010 with the creation of project collections that I haven't ventured further into trying to get the policies of 2005 or 2008 to work in VS11, but theoretically, the process should be the same. Just make sure that all the policies registered with TFS are of the same base version. So either register all 2005 or all 2008 or all 2010 policies. If you create a mixed bag you'll keep getting all kinds of errors in the various versions of Visual Studio.

    I've also worked out how to load existing VS2010 Code Analysis rules in VS11, which you might be interested in as well.

    My blog:

    • Modificato Jesse HouwingMVP martedì 27 marzo 2012 22:53 auto-linkify seems broken
    martedì 27 marzo 2012 22:53
  • Hi Jesse, thanks for the link; I had actually found it earlier this afternoon.  Unfortunately I'm looking for something more scalable than having every developer edit their devenv.exe.config file; we have close to 100 developers.  I also found this post too where he states that all he had to do was update the TFS references in the check-in policies project to point to the new VS 11 ones.  I haven't tried any of this yet; I'm just collecting the info on how to go about it.  Thanks, and when/if I attempt the upgrade I'll let you know how it goes.

    - Dan - "Can't never could do anything"

    martedì 27 marzo 2012 23:05
  • Hi Dan, I believe this will make the policies work in VS11, but won't let them work in VS2010 at the same time, so you'll have to deploy those separately and then hope that Visual Studio will accept the two different assemblies for the same policy.

    My blog:

    mercoledì 28 marzo 2012 07:31
  • Ok, thanks for the heads up Jesse.  We definitely need our policies to still work in VS 2010 as VS 11 doesn't support full round-tripping for our solution; our TF DB project and web service projects are not backwards compatible with VS 2010 once they've been upgraded by VS 11 Beta :(

    - Dan - "Can't never could do anything"

    mercoledì 28 marzo 2012 15:54