Does this work with TFS2008?

Apr 16, 2008 at 1:09 PM
Hi gmcadams,
I am curious to know whether this control works with TFS2008??? And also can you please provide some info on how to install this control or how to use it, as it be very useful. I saw the installation note and did things as listed there, but this doesnt seem to be working in TFS 2008 environment. Could you please throw some light on these things...
Thanks in advance...
May 13, 2008 at 4:56 PM
Edited May 19, 2008 at 12:53 AM
Hi Shabarie,

First of all, in order to get it to work at all, there is more to making this work than just what is in the installation notes.  You will need to edit your process template.  Here are some changes you'll need to make to your template in order to use the hierarchy custom control:

    1.  Add a field (integer) called Parent Work Item or something.

<
FIELD type="Integer" name="Parent Work Item" refname="MyThings.ParentWorkItem">
    <HELPTEXT>Link to parent Work Item</HELPTEXT>
</FIELD>

    2.  Add 2 controls to your layout (I chose to add them to their own tab).  The first control is the link to the parent.  The second control is the hierarchical list of children.

 

<Tab Label="Work Item Hierarchy">
    <Group>
        <Column PercentWidth="15">
            <Control FieldName="MyThings.ParentWorkItem" Type="WorkItemIdReference" Label="&amp;Parent Work item:" LabelPosition="Left" NumberFormat="WholeNumbers" MaxLength="10" />
        </Column>
        <Column PercentWidth="5" />
        <Column PercentWidth="80">
            <Control FieldName="System.Id" Type="WorkItemHierarchy" Label="&amp;Child Work Items:" LabelPosition="Top" Dock="Fill" />
        </Column>
    </Group>
</Tab>

Notice the type = WorkItemIdReference and the type = WorkItemHierarchy.  This is what tells your template to use your custom controls.

Next, you'll have to reference the 2008 versions of the DLLs and recompile in order to make it work with Visual Studio 2008.


Let me know if there is anything else keeping you from using this control.

Gabriel


shabarie wrote:
Hi gmcadams,
I am curious to know whether this control works with TFS2008??? And also can you please provide some info on how to install this control or how to use it, as it be very useful. I saw the installation note and did things as listed there, but this doesnt seem to be working in TFS 2008 environment. Could you please throw some light on these things...
Thanks in advance...



Jun 2, 2008 at 11:20 AM

Hi Gabriel,

Was working on the above control and proceeded as per the installation note, to deploy the control, and as per above reply from you. When I did all the things mentioned above and tried playing around with the TASK workitem type, and as soon as i try to create a new TASK workitem type, I get this pop-up and my TASK workitem doesnt open up at all. The pop-up is as follows: "Unable to cast object of type  'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem' to type 'Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem' " I just did a build for the project that is provided in this codeplex example and the Build was successful. I, as per the installation note, copied the WitCustomControl and the two wicc's to the path specified. Also as per your mail I did few changes to the TASK workitem type in the Task.xml, by doing a witimport and witexport technique. Have i done a mistake anywhere and is there any other step that I have to follow or is it any error concerned with external casting the custom control. If so, what do i need to do now.
Thanks a ton in advance..

-Shabarie

Jun 3, 2008 at 11:24 AM

Hi Gabriel,

One more thing that I noted is that the error above stated is not the actual one. When i debugged the code, I saw that the issue is present in the method GetCHildWorkItems in WorkItemPicker.cs file. This query "WorkItemStore store = parentWorkItem.Store;
   WorkItemCollection items = store.Query("SELECT [System.Id], [System.WorkItemType], [System.State], [System.Title] FROM WorkItems WHERE [System.TeamProject] = '" + parentWorkItem.Project.Name + "' AND [" + c_parentWorkItemFieldName + "] = " + parentWorkItem.Id.ToString() + " ORDER BY [System.WorkItemType], [System.Id]");" is the place which nurses this problem.

I was shocked to see that there is no such database called WorkItems, which is in bold in the above query. Can you please tell me what should be my further action? We have a requirement where one of our clients require this control. Appreciate any help frm your side.

-Shabariji

Oct 29, 2008 at 3:32 PM

For future reference, here's the answer to this one:

http://blogs.microsoft.co.il/blogs/srlteam/archive/2008/04/17/quot-unable-to-cast-object-quot-error-in-custom-control.aspx

And the post (just incase the link goes away):

As the previous post about moving custom controls said, there are problems using the TFS2005 custom controls in TFS2008.

While writing custom control to TFS 2008 there are several things that can go wrong. The most puzzling (to my experience) is to compile with the wrong assembly version.

If you compile the custom control with the old assembly version (i.e. Microsoft.TeamFoundation.WorkItemTracking.Controls.dll version 8.0.50727.762 which belongs to TFS 2005) and you don’t copy the system dll to the target client folder you will get the following error:

TF210004: The control could not be loaded from the assembly

TF210004: The control could not be loaded from the assembly 

If you copy the dll’s (version 8) to the directory, you will get a more confusing message:

Unable to cast object of type `YourCustomControl` to type `Microsoft.TeamFoundation.WorkItemTracking.Controls.IWorkItemControl`.”

Unable to cast object of type `YourCustomControl` to type `Microsoft.TeamFoundation.WorkItemTracking.Controls.IWorkItemControl

The solution is to compile the control with the dll in version 9.0.* and not version 8.0.*



--

And there you go.
--
mob

Nov 4, 2008 at 1:50 PM
Thank you guys, you're doing a great job!
Are you planing to do something for Web Access?
 Just some notes:
1.When using with 2005, refname should be something like "Someprefix.ParentWorkItem" -otherwise witimport refuses to upload it. There are two hardcoded string that uses this name in queries so thy should be updated to match the new refname.
2.About the previouse post: If you're using VS2005, you must use old (v8*) Microsoft.TeamFoundation.WorkItemTracking.Controls.dll and Microsoft.TeamFoundation.Common.Library.dll . They can be found in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies. VS's linker identifies some possible version conflicts and suggest to add binding redirect in app.config- this will fix problem for VS2008 

Best regards,
 tushkan
Jul 30, 2009 at 8:51 AM

Hi All,

Indeed a very good job had be done here,

I've downloaded the code, converted it to vs2008.

fixed some issues at the code that prevent the application from working.

Now it's seems to be working just fine.

 

Cheers,

Yaron

 

Aug 11, 2009 at 9:02 AM

Hi Yaron,

did you uploaded a patch for that also? I'm interested, too, in that feature for 2008.

Thanks