tags:

views:

1787

answers:

2

We have built a custom application, for internal use, that accesses TFS. We use the Microsoft libraries for this (e.g Microsoft.TeamFoundation.dll).

When this application is deployed to PCs that already have Team Explorer or VS installed, everything is fine. When it’s deployed to PCs that don’t have this installed, it fails.

We include all the required DLLs, but the error we get is “Common Language Runtime detected and invalid program”. The error occurs on the moderately innocuous line:

TeamFoundationServer myServer = new TeamFoundationServer(“ourserver.ourdomain.com”);

Interestingly the popular TFSAdmin tool (when you drop in the required DLLs to the exe directory) gives the same error.

I also note that many other custom applications that access TFS (e.g. http://hinshelwood.com/tfsstickybuddy.aspx) also require Team Explorer or VS to be installed to work.

Clearly the DLLs are not enough and there is some magic that happens when these installs occur. Anyone know what it is? Anyone know how to make the magic happen?

A: 

Try this list:

http://geekswithblogs.net/jjulian/archive/2007/06/14/113228.aspx

And also trying putting them in the GAC. It may be a security trust issue - assemblies in the GAC are granted a higher CAS level.

Cory Foy
+2  A: 

The "officially supported" way of writing an application that uses the TFS Object Model is to have Team Explorer installed on the machine. This is especially important for servicing purposes - i.e. making sure that when a service pack for VSTS is applied to the client machine then the TFS API's get upgraded as well. There are no re-distribution rights to the TFS API's therefore they should not be shipped with your application.

BTW - Also note that if you are writing an application that used the TFS OM, then be sure to compile it as "X86" only rather than "Any CPU". The TFS API assemblies are all marked X86, but if you app is marked "Any CPU" then on a x64 machine it will get loaded by the 64bit CLR but when it comes time to dynamically load the TFS Assemblies it will fail.

Good luck,

Martin.

Martin Woodward
Note that code using the TFS 2010 Object Model does not need to be compiled as X86 any more as the 2010 API now works with both versions of the CLR.
Martin Woodward