SpecificVersion=False with TFS API dll's

2019-03-01 12:22发布

Our web application makes heavy use of the TFS API. We developed and compiled it with the TFS 2010 API dll's. We also set SpecificVersion=False.

The problem is that when we deploy to a server that has TFS 2012 and not TFS 2010, we get the following error:

Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=10.0.0.0,.....etc. The system cannot find the file specified.

Any way to migitate this? TFS 2012 is installed into the GAC and the fact we are saying "SpecificVersion=False" should tell the app to use the 2012 (version 11) of the dll's instead of 2010 (version 10). Correct??

Any help appreciated...

标签: c# tfs-sdk
1条回答
beautiful°
2楼-- · 2019-03-01 12:48

Specific version does not work if the assembly is strong name signed. Microsoft almost certainly strong-name signed their assembly.

Your website will have to make use of a bindingRedirect to redirect all versions to from v10 to v11. For example:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
         <dependentAssembly>
            <assemblyIdentity name="Microsoft.TeamFoundation.Client"
                              publicKeyToken="xxxxxxxxxxxxx"
                              culture="neutral" />
            <bindingRedirect oldVersion="10.0.0.0"
                             newVersion="11.0.0.0"/>
         </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

Make sure to update the publicKeyToken to the correct value.


Alternatively, you could recompile the website against the v11 version of the TFS SDK to avoid the binding redirect, however then it will only work with v11 of the TFS SDK.

查看更多
登录 后发表回答