I have written a tool that will report on the Changesets and Work Items included in builds. When I run this tool on my local machine that has TFS 2010 installed, it works fine, however when I run the tool on a machine that is on our domain but does not have TFS installed, I get exceptions when the tool tries to get Work Items or Work Item Stores.
Initially, my tool selects the builds between selected dates, and for each build it will get the details for the associated changesets
Changeset changeSet = versionControl.GetChangeset(changeSetId);
For each changeset, it will get the associated work items
WorkItem csWorkItems = changeSet.WorkItems
I am getting the following exception at this point on domain machines (that do not have any sort of development suite installed):
System.NullReferenceException: Object reference not set to an instance of an object at
As I have not been able to find a way to get around this, I tried a different route and decided to get the work items straight from the build information. In order to do this I need a WorkItemStore
workItemStore = new WorkItemStore(tfs);
I am getting the following at this point:
System.TypeInitializationException: The type initializer for 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore' threw an exception. ---> System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
There are several things I don't understand about these problems:
1. It would seem that my tool can connect to TFS, query the builds and get details for the changesets BUT NOT THE WORK ITEMS - why is this? At this point I'm assuming that it is due to TFS not being installed, but if that is the case then why can it connect to TFS, and then get build and changeset information?
2. Am I missing something from my tool? I have packaged it into an installer and the detected dependencies have included the following libraries:Microsoft.TeamFoundation.Build.Client.dll
Can anyone help me with getting the details for the Work Items?
Thanks in advance
- Edited by TheVermin Wednesday, April 04, 2012 1:38 PM
This exception might be related to local TFS Cache missing on the machine.
Here is the similar thread
Hope this helps
My TFS Blog
Please remember to mark as answered, if this reply helps
Adding the following section to my App.config worked for me
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>