title: C# Custom Applications that Access TFS
body: <p>We have built a custom application, for internal use, that accesses TFS.  We use the Microsoft libraries for this (e.g Microsoft.TeamFoundation.dll).</p>
  
  <p>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.</p>
  
  <p>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:</p>
  
  <pre><code>TeamFoundationServer myServer = new TeamFoundationServer(“ourserver.ourdomain.com”);
  </code></pre>
  
  <p>Interestingly the popular TFSAdmin tool (when you drop in the required DLLs to the exe directory) gives the same error.</p>
  
  <p>I also note that many other custom applications that access TFS (e.g. <a href="http://hinshelwood.com/tfsstickybuddy.aspx" rel="nofollow noreferrer">http://hinshelwood.com/tfsstickybuddy.aspx</a>) also require Team Explorer or VS to be installed to work.</p>
  
  <p>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?</p>