How to load TFS dlls independent of version? RRS feed

  • Question

  • I have this:

    $NS_TF_COMMON = 'Microsoft.TeamFoundation.Common';
    $NS_TF_CLIENT = 'Microsoft.TeamFoundation.Client';
    $NS_VC_CLIENT = 'Microsoft.TeamFoundation.VersionControl.Client';
    $TFS_ASS_VERSION =    'Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a';
    Win32::CLR->load("$NS_TF_CLIENT, $TFS_ASS_VERSION");
    Win32::CLR->load("$NS_TF_COMMON, $TFS_ASS_VERSION");
    Win32::CLR->load("$NS_VC_CLIENT, $TFS_ASS_VERSION");

    This is Perl, but essentially this results in

    System.Reflection.Load("Microsoft.TeamFoundation.Common, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

    This works on a machine that has VS2010 installed, but not on a machine which only has VS2012 to work. In the latter case, Version must be I want my code to work, matter whether version 10 or 11 of the TFS API is installed.

    I realise I could achieve this by attempting to load version 11, and if this fall back to load version 10. (I already have this today, as I also support my package to run on a machine with TFS support at all.) But is there any more elegant way?

    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Tuesday, May 14, 2013 5:45 PM


All replies

  • Hi,

    Thank you for your post.

    I am trying to involve someone to further look at this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding and support.


    Lily Wu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 15, 2013 7:24 AM
  • You are able to load assembly without specify version, that is the partial name load. 


    However, load assembly with partial name doesn't look better than your existing solution. It may load assembly of unexpected version, and take the application to unknown state. Check the details from here:


    Forrest Guo | MSDN Community Support | Feedback to manager

    Thursday, May 16, 2013 3:05 AM
  • So it would load is this version is found. And which does not work my tool, so it would die just a little later.

    Furthermore, LoadWithPartialName is declared obsolete in MSDN, why I had discarded this option before my post.

    Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
    Thursday, May 16, 2013 7:37 AM