[#TFS2010] HowTo: Agregar un nuevo mapeo entre campos de Microsoft Project y Team Foundation Server


image47dd1de4

Buenas,

hoy un post tipo tutorial para mostrar como sincronizar un campo de Microsoft Project con un campo de una definición de un WorkItem de Team Foundation Server. Para este ejemplo he agregado un campo a la definición de una Task que se llama “ElBruno.WbsCode” (si no sabes como hacerlo este post te puede ayudar). La idea para este post es sincronizar el campo de Microsoft Project WBS con este nuevo campo de la Task.

Para esto seguiremos los siguientes pasos.

Tutorial

1. Abrir una consola de comandos de Visual Studio 2010.

2. Descargar el archivo de mapeo con un comando similar al siguiente:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tfsfieldmapping download /collection:http://w7-brunoc:8080/tfs/tpc /teamproject:A02 /mappingfile:"C:\mappingfile.xml"

LA sintaxis y los pasos los puedes encontrar aquí.

3. Editar el archivo que hemos descargado y agregar el mapeo entre los 2 campos con los que estamos trabajando. En este caso es en la línea 20 en donde se define el mapeo. Un detalle importante es que para los campos de Microsoft Project, es necesario poner el prefijo “pjTask” antes del nombre del mismo.

   1: <?xml version="1.0" encoding="utf-8"?>

   2: <MSProject>

   3:   <Mappings>

   4:     <Mapping WorkItemTrackingFieldReferenceName="System.AreaPath" ProjectField="pjTaskOutlineCode9" />

   5:     <Mapping WorkItemTrackingFieldReferenceName="System.AssignedTo" ProjectField="pjTaskResourceNames" />

   6:     <Mapping WorkItemTrackingFieldReferenceName="System.Id" ProjectField="pjTaskText10" ProjectName="Work Item ID" />

   7:     <Mapping WorkItemTrackingFieldReferenceName="System.IterationPath" ProjectField="pjTaskOutlineCode10" />

   8:     <Mapping WorkItemTrackingFieldReferenceName="System.Reason" ProjectField="pjTaskText14" />

   9:     <Mapping WorkItemTrackingFieldReferenceName="System.Rev" ProjectField="pjTaskText23" />

  10:     <Mapping WorkItemTrackingFieldReferenceName="System.State" ProjectField="pjTaskText13" ProjectName="State" />

  11:     <Mapping WorkItemTrackingFieldReferenceName="System.Title" ProjectField="pjTaskName" />

  12:     <Mapping WorkItemTrackingFieldReferenceName="System.WorkItemType" ProjectField="pjTaskText24" />

  13:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Common.Priority" ProjectField="pjTaskText19" ProjectName="Work Item Priority" />

  14:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Common.StackRank" ProjectField="pjTaskNumber1" />

  15:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.CompletedWork" ProjectField="pjTaskActualWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />

  16:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.FinishDate" ProjectField="pjTaskFinish" PublishOnly="true" />

  17:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.OriginalEstimate" ProjectField="pjTaskBaselineWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />

  18:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.RemainingWork" ProjectField="pjTaskRemainingWork" ProjectUnits="pjHour" IfSummaryRefreshOnly="true" />

  19:     <Mapping WorkItemTrackingFieldReferenceName="Microsoft.VSTS.Scheduling.StartDate" ProjectField="pjTaskStart" PublishOnly="true" />

  20:     <Mapping WorkItemTrackingFieldReferenceName="ElBruno.WbsCode" ProjectField="pjTaskWBS" PublishOnly="true" />

  21:     <LinksField ProjectField="pjTaskText26" />

  22:     <SyncField ProjectField="pjTaskText25" />

  23:   </Mappings>

  24: </MSProject>

4. Ahora debemos subir esta definición de mapeos nuevamente a nuestro servidor TFS, para esto utilizamos el siguiente comando:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>tfsfieldmapping upload /collection:http://w7-brunoc:8080/tfs/tpc /teamproject:A02 /mappingfile:"C:\mappingfile.xml"

5. Done !!!

6. Si ahora modificamos estas tareas desde Microsoft Project, como muestra la siguiente imagen

image

cuando sincronizemos las mismas con TFS, ya podremos ver el campo de Microsoft Project WBS, en el campo “ElBruno.WbsCode” de la Task.

image

 

Saludos @ Home

El Bruno

   

[# TFS2010] TFSWorkBench is now OpenSource


image47dd1de4

Good,

This is fast because it runs from the train and will not be the driver of the train are excited with the news, turn where it should not and can not reach Madrid.

As I said, TFS WorkBench that excellent tool to analyze information about our WorkItems of the people ofScrumForTeamSystem, is now Open Source on CodePlex.

If you don’t remember that is the tool, my personal backup, i.e. my blog can help you with the entry of the dayhttp://elbruno.com/2011/04/27/tfs2010-tfs-workbench-herramienta-para-trabajar-con-tableros-con-elementos-de-tfs/

And but, you can go directly to CodePlex, download the code from here and start tinkering with it.

 

Greetings @ Here

The Bruno

   

Download: http://tfsworkbench.codeplex.com/

[#TFS2010] TFSWorkBench ahora es OpenSource


image47dd1de4

Buenas,

esta es rápida porque va desde el tren y no vaya a ser que el conductor del tren se emocione con la noticia, gire donde no deba y no pueda llegar a Madrid.

Pues lo dicho, TFS WorkBench esa excelente herramienta para analizar la información de nuestros WorkItems de la gente de ScrumForTeamSystem, ahora es Open Source en CodePlex.

Si no te acuerdas de que va la herramienta, mi backup personal, es decir mi blog te puede ayudar con la entrada del día http://elbruno.com/2011/04/27/tfs2010-tfs-workbench-herramienta-para-trabajar-con-tableros-con-elementos-de-tfs/

Y sino, puedes ir directamente a CodePlex, descargar el código desde aquí y comenzar a juguetear con la misma.

 

Saludos @ Here

El Bruno

   

Descarga: http://tfsworkbench.codeplex.com/

[#TFS2010] HowTo: Add a State in the definition of a WorkItem (III)


image47dd1de4

Series

  1. HowTo: Add a State in the definition of a WorkItem (I)
  2. HowTo: Add a State in the definition of a WorkItem (II)

Good,

in the previous post we saw how to add a new State to the definition of States of a WorkItem type Task to MSF for Agile5.0. In this post we will add a number of conditions to be fulfilled in the actions of state change.

A condition of business can be the following:

A Task may not pass state [Proposed] to [Active] if the hours estimated, completed, and remaining information defined in the same has not been completed.

To achieve this condition follow the following steps, from the definition of the Task that we completed in the previous post.

Tutorial

1 Edit the definition of a Task and access to the tab [Workflow]

2 Select the transition [Proposed > > Active], we deploy the contextual menu and select the option [Open Details]

3 Select [Fields] tab to add the fields on which we work.

4 Add a new field, select [Microsoft.VSTS.Scheduling.OriginalEstimate]

image

5. In the tab [Rules], add a new rule. In this case to define the field is required

image

6 We also add the fields [Microsoft.VSTS.Scheduling.RemainingWork], and [Microsoft.VSTS.Scheduling.CompletedWork] as required fields in the transition.

image

7. In the Workflow diagram we see as these fields are marked as fields of work in the transition [Proposed > > Active]

image

8 Save the definition of the Task on the server, chill Team Explorer and create a new task.

9 When we create the same we can see that initial state [Proposed] presents no restriction at the time to create it.

10. When the state change to [Active] see that fields of effort (hours) are marked as active, which marks the rule defined for the transition.

image

 

Greetings @ Here

The Bruno

   

[#TFS2010] HowTo: Agregar un estado en la definición de un WorkItem (III)


image47dd1de4

Series

  1. HowTo: Agregar un estado en la definición de un WorkItem (I)
  2. HowTo: Agregar un estado en la definición de un WorkItem (II)

Buenas,

en el post anterior vimos como agregar un nuevo estado a la definición de estados de un WorkItem de tipo Task para MSF for Agile 5.0. En este post agregaremos una serie de condiciones que se deben cumplir en las acciones de cambio de estado.

Una condición de negocio puede ser la siguiente:

Una Task no puede pasar del estado [Proposed] a [Active] si no se ha completado la información de horas estimadas, completadas y pendientes definida en la misma.

Para lograr cumplir esta condición seguiremos los siguientes pasos, a partir de la definición de la Task que completamos en el post anterior.

Tutorial

1. Editamos la definición de una Task y accedemos a la pestaña [Workflow]

2. Seleccionamos la transición [Proposed >> Active], desplegamos el menú contextual y seleccionamos la opción [Open Details]

3. Seleccionamos la pestaña [Fields] para agregar los campos sobre los que queremos trabajar.

4. Agregamos un nuevo campo, seleccionando [Microsoft.VSTS.Scheduling.OriginalEstimate]

image

5. En la pestaña [Rules], agregamos una nueva regla. En este caso para definir que el campo es requerido

image

6. Agregamos también los campos [Microsoft.VSTS.Scheduling.RemainingWork] y [Microsoft.VSTS.Scheduling.CompletedWork] como campos requerido en la transición.

image

7. En el diagrama del Workflow podremos ver como estos campos, se marcan como fields de trabajo en la transición [Proposed >> Active]

image

8. Guardamos la definición de la Task en el servidor, refrescamos el Team Explorer y creamos una nueva tarea.

9. Cuando creamos la misma podemos ver que el estado inicial [Proposed] no presenta ninguna restricción al momento de crearla.

10. Cuando cambiamos el estado a [Active] vemos que los campos de esfuerzo (horas) se marcan como activos, con lo que se cumple la regla que definimos para la transición.

image

 

Saludos @ Here

El Bruno

   

[#TFS2010] HowTo: Add a State in the definition of a WorkItem (II)


image47dd1de4

Series

  1. HowTo: Add a State in the definition of a WorkItem (I)

 

Good,

today with the already installed software to begin modifying the definition of a WorkItem. For this trabajeremos on a Team Project of test called [AgileBlog]. The following steps demonstrate how to modify a WorkItem definició

Tutorial

1 Open Visual Studio 2010 and access the menu [Tools / / Process Editor / / WorkItem Types / / Open WIT from Server]

2. Select the corresponding TP and within the same select WIT Task.

3. At this point we will see the form of editing for the definition of an WI in Visual Studio 2010. The WorkFlow tab shows the current process with the States through which passes the WorkItem. As we see it, the first State is the ACTIVE.

image

4 Activate the ToolBox of Visual Studio 2010 and in it we see that we have elements of type status and Transition to work on the definition of the WorkFlow.

image

5 Added a new State and changed the name of a [Proposed].

image

6 Add transitions to change state of [Proposed] to [Active] and [activate] [Proposed], but no great change in [Closed] a [Proposed]

image

7. As the first transition is associated to [Active] and I assume that you’ve already tried with the mouse giving [Proposed], we’ll change it to make the first State [Proposed]. To do this select the transition, deploy the contextual menu and select the option [Open Details]. Then, in the form of editing, select [Proposed] as the State target of the transition.

image

8. At this point, the States and transitions should be similar to the following image.

image

9. If we accept the scheme we have defined, deploying the conextual menu and selected the option to [Validate All], we will see that the definition is correct, we should add at least one reason (Reason) State in our workflow changes.

image

10 Edit the transíción [Proposed > > Active], select [Reasons] tab and edit the Reasons that there is a reason by default called [Accepted]

image

11. In the transition [Active > > Proposed] add 2 possible reasons: [Rejected] and [More Information is Required] as shown in the following image.

image

12. If we expand the graph to see details of the transitions, we can see the changes we have applied to the task.

image

13 We keep the definition of the WorkItem. This change applies on the TFS server, so it may take a while. Select the Team Project in Team Explorer pane and chill the contents thereof. If we create a new Task, you will see that the initial state is [Proposed] and that the Reason [New]

image

14. Once created the Task, we see that it is possible to change the status to [Active] and that the proposed Reason is [Accepted]

image

15. Finally we see that if we change the State of [activate] [Proposed] proposed Reason are those defined in the previous steps.

image

 

Greetings @ Home

The Bruno

[#TFS2010] HowTo: Agregar un estado en la definición de un WorkItem (II)


image47dd1de4

Series

  1. HowTo: Agregar un estado en la definición de un WorkItem (I)

 

Buenas,

hoy con el software ya instalado comenzaremos a modificar la definición de un WorkItem. Para esto trabajeremos sobre un Team Project de prueba llamado [AgileBlog]. Los siguientes pasos demuestran como modificar la definició de un WorkItem

Tutorial

1. Abrir Visual Studio 2010 y acceder al menu [Tools // Process Editor // WorkItem Types // Open WIT from Server]

2. Seleccionar el TP correspondiente y dentro del mismo seleccionar el WIT Task.

3. En este punto veremos el formulario de edicion para la definición de un WI en Visual Studio 2010. La pestaña WorkFlow nos muestra el proceso actual con los estados por los que pasa el WorkItem. Como vemos en el mismo, el primer estado es el estado ACTIVE.

image

4. Activamos la ToolBox de Visual Studio 2010 y en la misma vemos que tenemos elementos de tipo Estado y Transition para trabajar sobre la definición del WorkFlow.

image

5. Agregamos un nuevo estado y modificamos el nombre del mismo a [Proposed].

image

6. Agregamos transiciones para poder cambiar de estado de [Proposed] a [Active] y de [Active] a [Proposed], pero no habilitamos el cambio de [Closed] a [Proposed]

image

7. Como la primer transición está asociada a [Active] y supongo que ya habrás intentado con el mouse asignarla a [Proposed], cambiaremos la misma para que el primer estado sea [Proposed]. Para esto seleccionamos la transición, desplegamos el menú contextual y seleccionamos la opción [Open Details]. Luego, en el formulario de edición, seleccionamos [Proposed] como el estado destino de la transición.

image

8. En este punto, los estados y transiciones deben ser similares a la siguiente imagen.

image

9. Si validamos el esquema que hemos definido, desplegando el menú conextual y seleccionado la opción [Validate All], veremos que para que la definición sea correcta, debemos agregar por lo menos una razon (Reason) a los cambios de estado en nuestro workflow.

image

10. Editamos la transíción [Proposed >> Active], seleccionamos la pestaña [Reasons] y editamos las Reasons para que existan una razón por defecto llamada [Accepted]

image

11. En la transición [Active >> Proposed] agregamos 2 posibles reasons: [Rejected] y [More Information is Required] como muestra la siguiente imagen.

image

12. Si expandimos el gráfico para ver el detalle de las transiciones, podremos ver los cambios que hemos aplicado en la tarea.

image

13. Guardamos la definición del WorkItem. Este cambio se aplica en el servidor TFS, por lo que puede tardar un poco. Seleccionamos el Team Project, en el panel del Team Explorer y refrescamos el contenido del mismo. Si creamos una nueva Task, veremos que el estado inicial es [Proposed] y que la Reason es [New]

image

14. Una vez creada la Task, vemos que es posible cambiar el estado a [Active] y que la Reason propuesta es [Accepted]

image

15. Finalmente vemos que si cambiamos el estado de [Active] a [Proposed], las Reason propuestas son las que definimos en los pasos anteriores.

image

 

Saludos @ Home

El Bruno

   

[TFS2010] HowTo: Add a State in the definition of a WorkItem (I)


image47dd1de4

Good,

first a disclaimer:

99.999% Of cases, the definition by default of a WorkItem is enough for a team. It is possible to modify the definition of a WorkItem does not mean that you should do so.

Now that you have thought if the definition of States has by default a WorkItem is necessary and you’ve come to the conclucsión that you need to modify it, then go ahead. For this we have some templates that you can install Team Foundation Server 2010, in this case we will work with the definition of a Task of MSF for Agile 5.0 (the formal definition of Agile on MSDN are available from here)) .

A Task has the following States

Task state diagram

and for this series of posts, the initial idea is to add a new State called “proposed”.

For this we will work with the following software:

 

Greetings @ Home

The Bruno

   

Resources:

Task (Agile) http://msdn.microsoft.com/en-us/library/dd380700.aspx

[TFS2010] HowTo: Agregar un estado en la definición de un WorkItem (I)


image47dd1de4

Buenas,

en primer lugar un disclaimer:

En el 99,999% de los casos, la definición por defecto de un WorkItem es suficiente para un equipo de trabajo. Que sea posible modificar la definición de un WorkItem no significa que debas hacerlo.

Ahora que has pensado si la definición de estados que posee por defecto un WorkItem es necesario y has llegado a la conclucsión de que necesitas modificarla, pues adelante. Para esto tenemos alguna de las plantillas que se pueden instalar en Team Foundation Server 2010, en este caso trabajaremos con la definición de una Task de MSF for Agile 5.0 (la definición formal de Agile en MSDN se pueden consultar desde aquí) .

Una Task posee los siguientes estados

Task state diagram

y para esta serie de posts, la idea inicial es agregar un nuevo estado inicial llamado “Proposed”.

Para esto trabajaremos con el siguiente software:

 

Saludos @ Home

El Bruno

   

Resources:

Task (Agile) http://msdn.microsoft.com/en-us/library/dd380700.aspx

[TFS2010] HowTo: Create a WorkItem with custom fields using c#


image47dd1de4

Good,

While the object model in Visual Studio 2010 to work with Team Foundation Server 2010 is not very complex, there are some particularities to be taken into account. For example, when we want to create a WorkItem that we changed you the structure of fields.

For example, for the definition of a task we have added 2 more to the same text fields, named “version” and “scope”, and then we’ve added them visually to the edit form (if you want to see how it is possible to make this change, this post is for you). In the following image it is possible to see how the “version” field is required for the creation of a task.

image

If we take the example available from MSDN for the creation of a WorkItem using the Client Object Model, we see that the same not takes into account the use of custom fields. We modify it to save data from a task, as shown in the following code:

   1: using System;

2: using Microsoft.TeamFoundation.Client;

3: using Microsoft.TeamFoundation.WorkItemTracking.Client;

4: 

5: namespace ElBruno.CreateWiFromCode

6: {

7: class Program

8: {

9: static void Main(string[] args)

10: {

11: var collectionUri = new Uri(“http://localhost:8080/tfs/tpb&#8221;);

12: var tpc = new TfsTeamProjectCollection(collectionUri);

13: var workItemStore = tpc.GetService<WorkItemStore>();

14: var teamProject = workItemStore.Projects["AgileLabs"];

15: var workItemType = teamProject.WorkItemTypes["Task"];

16: 

17: var task = new WorkItem(workItemType)

18: {

19: Title = “Sample Title”,

20: Description = “Sample desc”

21: };

22: task.Save();

23: 

24: Console.WriteLine(@”WorkItem id: ” + task.Id);

25: Console.ReadLine();

26: }

27: }

28: }

When you want to save the WI line (22), we find the following exception:

image

   1: Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException was unhandled

2: Message=TF237124: Work Item is not ready to save

3: Source=Microsoft.TeamFoundation.WorkItemTracking.Client

4: IsRemoteException=false

5: ErrorId=0

6: LogException=false

7: StackTrace:

8: at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save(SaveFlags saveFlags)

9: at Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem.Save()

10: at ElBruno.CreateWiFromCode.Program.Main(String[] args) in

11: at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)

12: at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)

13: at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()

14: at System.Threading.ThreadHelper.ThreadStart_Context(Object state)

15: at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)

16: at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

17: at System.Threading.ThreadHelper.ThreadStart()

18: InnerException:

 

The solution is to define the value of the “version” field in order to thus fulfil the fields required for the task. One of the possible ways to view the status of an WI, is analyzing the IsDirty field of the same. In this case we can perform the following validation

   1: var task = new WorkItem(workItemType)

2: {

3: Title = “Sample Title”,

4: Description = “Sample desc”

5: };

6: if(task.IsDirty)

7: Console.WriteLine(“Can’t save WorkItem”);

8: else

9: task.Save();

 

The objective of the post was to explain how to add values to the custom fields, in this case the magic performed again, line 22.

   1: using System;

2: using Microsoft.TeamFoundation.Client;

3: using Microsoft.TeamFoundation.WorkItemTracking.Client;

4: 

5: namespace ElBruno.CreateWiFromCode

6: {

7: class Program

8: {

9: static void Main(string[] args)

10: {

11: var collectionUri = new Uri(“http://localhost:8080/tfs/tpb&#8221;);

12: var tpc = new TfsTeamProjectCollection(collectionUri);

13: var workItemStore = tpc.GetService<WorkItemStore>();

14: var teamProject = workItemStore.Projects["AgileLabs"];

15: var workItemType = teamProject.WorkItemTypes["Task"];

16: 

17: var task = new WorkItem(workItemType)

18: {

19: Title = “Sample Title”,

20: Description = “Sample desc”

21: };

22: task.Fields["ElBruno.Version"].Value = “version 01″;

23: task.Save();

24: 

25: Console.WriteLine(@”WorkItem id: ” + task.Id);

26: Console.ReadLine();

27: }

28: }

29: }

 

Greetings @ Here

The Bruno

   

Source: http://msdn.microsoft.com/en-us/library/bb130322.aspx#Y697