Showing posts with label TFS. Show all posts
Showing posts with label TFS. Show all posts

Wednesday, July 6, 2016

TFS 2013 Team Build : Part 2 - How to change the default build number format of a build definition.

How to change the default build number format of a build definition to give meaningful names to the completed builds.
Hi All,
In this post we will see how we can change the Build Number format to give meaningful names to the completed builds. By default the build number format of the build is: $(BuildDefinitionName)_$(Date:yyyyMMdd)$(Rev:.r)

SampleCI_20160706.1
Example: If my build definition name is SampleCI then the build number will be:
  •         SampleCI_20160706.1
  •         SampleCI_20160706.2
  •         SampleCI_20160706.3

To change this to some other format, we have to go to any of the build definition we have created or new. In the Build Definition go to BuildNumberFormat process parameter in “Process Tab”.
Our goal is to change the build number format as shown below, we want to capture the team project name also in the build number. $(TeamProject)_$(BuildDefinitionName)_$(Date:yyMMdd)$(Rev:.r) let’s see how to do this.


Step 1. Create a new Build Definition or open existing build definition, then click on Process tab.

Step 2. Under Process tab, look for Build Number Format process parameter and click on the ellipses button as shown in below screenshot.


Step 3. In the BuildNumber Format Editor window, you can see default build number format string and its preview. To see and add the other tokens click on Macros >> button.


Step 4. On clicking Macros >> button, you can see all available list of tokens and its values as shown in below screenshot



Step 5. Since we wants to add the $(TeamProject) token before $(BuildDefinitionName), place the cursor at the starting point i.e. before $(BuildDefinitionName), tag as shown below. Then select the $(TeamProject) token and click on Insert button.



Step 6. On clicking Insert button, we will see that the token is been added to the format string and we can modify the string by adding a underscore symbol (_) to differentiate between Team project name and build definition name as shown below. Click Ok button


Step 7. That’s all, we are done with setting the build number format to
$(TeamProject)_$(BuildDefinitionName)_$(Date:yyMMdd)$(Rev:.r)
We can see the format in the build process parameter value as below.



Step 8. Save the changes to the build definition and queue the build.


In the My Builds dropdown list of Team Explorer builds page we can see that build number also includes Team Project name , here in my case Team project name is FabrikamFiber and build definition name is DemoApp


Below screenshot shows the Team Project Name in build summary report




Hope you enjoyed this blog. Let me know for any queries.


Monday, June 27, 2016

TFS Work Item Customization using TFS Power Tool: Part 5

How to restrict the user or group from creating or updating a specific work item type.

 

Hi All,

In this post we will see how to stop a user or group from creating or updating a particular work item type in TFS team project.

In TFS team project we can either give read/write permission to all work item type or none of them, but it is not possible to restrict the user or group from creating or editing a specific work item type like bug or task.

In this post I’m going to provide a work around to achieve the requirement- where a user or group should be able to create or update all work item types except Bug, let us see how to do this.

    1.      Open bug work item template using process tab.

    Open Visual Studio, and Click on TOOLS -> Process Editor-> Work Item Types-> Open WIT from server, to open the template online.

       

      https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6aY-PWA-6JDK8_dsu3Viqlf38S9hPbzKwwxtS1yczhd0mVud780Xf_yZPiqAHP-YZdbOUSwRxbYK1dPm4c7lCSzE8AfCwKUB6gVVD_TWenuifbDAnvXCz-khxenP3jbXoIXCZnD3mGXoB/s1600/OpenTaskOnline.png

      2.      Now connect to the TFS and then to the Team Project under the Team Project Collection. Select work item type Bug.

       

      3.      Look for field Changed by and double click on it to edit.

       

      4.      When Field Definition window opens, click on Rules tab to add a new rule READONLY by clicking New button.

      5.      In the Select a rule type window select rule named READONLY, then click OK.

      6.      Now time to use this rule to achieve our requirement, identify the group to which this bug work item type should not be editable. Here in my example I want make bug work item type non editable for members of the Team Project Default group Contributors.

      Pass the value [project]\Contributors in the field For, find below screenshot for your reference.

      Then click OK.

      7.      Now you will see the new rule added to the list. Click OK. Then Save changes to server by clicking Save button of Visual Studio or using key board shortcut , Ctrl+s

       

      8.      Now connect to Team Project then open Team Project Administer Sever Page by clicking on  Administer Server gear button.

       

      9.      In Team Project Administer Sever Page open Security Tab. Under Security Tab look for group Contributors and add a windows user by clicking Add button under Members tab.

       

       

      Search for the member. Then click on Save changes button.

       

      Now a new member (Brian Keller) is added to the group Contributors.

      10.   Now login as one contributor member and connect to Team Project, here it is Awesome Team Project.

      11.   Click on Create new, dropdown list and select Bug work item type.

      12.   Enter the details and then click on Save button.

      13.   On Clicking save this user will be prompted with message as shown in below screenshot. By this way can restrict user from creating and updating Bug work item type.

       

      Hope you enjoyed this blog.

      Happy blogging J

       

Tuesday, April 12, 2016

Different ways to create Team Project for VSTS default collection

Visual Studio Online(VSO) is now  Visual Studio Team Services (VSTS)


Hi All, 
In my previous post on VSO (i.e VSTS) I have explained the steps to create free VSTS account,in this post we will explore different options for creating new team project in VSTS account. As we all know in VSTS we can have only one collection , i.e. DefaultCollection under which we can create multiple team projects. Here are the different options to create Team Project.

Connect to your VSTS account (Ex: https://explorevsonline.visualstudio.com/)

Method 1:

Below screen will appear if you have opted out creating team project during VSTS account creation or there is no Team Project created on your VSTS account. On this page you can input details like Team Project name, choose process template,select the version control type(Git or TFVC) then click on Create project button.


Method 2:

Another way for creating team project is by clicking on  Manage Account i.e the gear button at the top-right corner as shown in the below screenshot,



 when you click on the gear button as shown above you will be redirected to the VSTS admin page. In this admin page you can find the control panel tab and you can also find link for creating new Team project. Click on "Create a new team project" link present at the right side under Control panel, which will pop up "CREATE TEAM PROJECT" window, now you can enter the details as mentioned in Method 1


Method 3:

In case you have already created a Team Project and want to create one more, use below option to quickly create a team project.
In your VSTS account Overview tab you can find "New" link under "Recent projects & teams" section as highlighted in below image, click on the "New" link. You will get pop up "CREATE TEAM PROJECT" window, now you can enter the details as mentioned in Method 1




Method 4:

If you have already connected to the team project and using any of the tabs like, Home /Code / Work / Test / Release / Build, you can quickly create new team project by clicking on the current team project link, which displays the drop down list with option for "New team project" as highlighted below. Click on "New team project" option. You will get pop up "CREATE TEAM PROJECT" window, now you can enter the details as mentioned in Method 1


hope this article finds you  interesting, happy blogging :)

Saturday, April 2, 2016

TFS 2013 Team Build : Part 1- Run a script in your build process

How to call a Batch Script or a PowerShell Script using TFS 2013 Team Build Pre-Build or Post-Build parameters option.

Now in TFS 2013 team build we can run the Batch Scripts or PowerShell Scripts without modifying the build process template. For this we will make use of any one or combination of these events based on the requirement i.e. Pre-Build or Post-Build or Pre-Test or Post-Test process parameters in Build Definition process tab.

Lets assume that we have an application already in TFS Version control which will be used in the below build definition.



In this post I will showcase how to call a Batch Script from build definition which will create a text file with some text messages.

Step 1: Create a simple Batch file named CreateTextFile.bat with scripts as shown below,



Step 2: Connect to TFS Team Project , add and Check-in batch script file CreateTextFile.bat to the Version Control.



Step 3: Create a build definition using TFS 2013 default build template and make sure that the script file is mapped to the agent folder in Source Setting tab of build definition.



Step 4: In build definitions Process tab provide the version control path of CreateTextFile.bat as below.



Step 5: Trigger the build and verify that DemoTextFile.txt is created in path C:\


We can follow the above steps to execute PowerShell or any scripts using team build.

Thanks.

TFS Work Item Customization using TFS Power Tool: Part 3



Customize “Assigned To” field to list users only from the team project.



Hi All,
In this post I will show you how we can customize “Assigned To” field of task work item to list members only from Team Project.
By default TFS work item “Assigned To” field displays all the users from Team Project Collection. Most of our customer came with the request that they want to list only the users from their team project so that it will be easy to select the users to assign any work item to them, here is the steps to achieve the same.
In this blog I am going to show how edit work item online/in the server, without exporting and modifying offline and importing back to TFS.
Open Visual Studio, and Click on TOOLS -> Process Editor-> Work Item Types-> Open WIT from server, to open the template online.



Now connect to the TFS and then to the Team Project under the Team Project Collection.  Here collection is Awesome Collection.

 Select work item type Task (can be any other work item type)


In the fields tab, double click on “Assigned To” field.



In the Field Definition window click on Rules tab. Here we can see that already there are two rules defined, ALLOWEXISITINGVAUE and VALIDUSER.



Since we want to list users only from the team project, I suggest you to make use of the team project group called “Project Valid Users”, since all users who are members of the team project will automatically become member of “Project Valid Users” group.
Now click on New and select rule named, ALLOWEDVALUES then click OK.

In the next window we can add new list by clicking New.

In the text box enter the value [project]\Project Valid Users then click OK.


Check the option Exclude Groups to eliminate groups from the list. This will exclude TFS groups from listing in the drop down. Then click OK.


Click OK again.


Now our template is ready to be saved. Save the changes by clicking on “Save” button or ctrl+S. Since we are editing template online, the changes are saved directly to TFS Server, changes will reflect in your Visual Studio/Team Explorer task work items after you Refresh the connection.
Thanks for reading this blog. Hope you enjoyed.

TFS Work Item Customization using TFS Power Tool: Part 1

In this post I will explain how we can add a custom field for a work type of existing team project.
To customize work item template we can make use of TFS power tool or witadmin command prompt options.
In this post I will show case TFS work item customization using TFS power tool.

Adding custom field using TFS power tool.

We can download Microsoft Visual Studio Team Foundation Server 2013 Power Tools from here, same link will also provide all other feature details of power tool.
When we use power tool to customize the work item template, we can do customization directly on server or we can export the template to local machine and import it to team project after customization.
To Export the template from the team project to local machine follow below steps.
Open Visual Studio 2013.
Click on TOOLS -> Process Editor-> Work Item Types->Export WIT


Connect to the Team Project collection. Here collection name is Awesome Collection.


Then select the Task Work Item Type from the Team Project of which work item template has to be customized the Click OK

Save the template in local machine.


When Asks for the pop up with message “Would you like in include the Global List definition?” Click on No button.

Below pop up window will appear on successful export of the template.


Now we can open the template in Visual Studio using power tool. Click on TOOLS -> Process Editor-> Work Item Types->Open WIT from File 


This is how template will look in Visual Studio when power tool is installed. This is called template editor and we will see the Name and Description of the template also 3 tabs named Fields, Layout and Workflow.

In Fields tab we can create or define new work item field with different rules or validations. Once we define field, we can make this field appeared in the work item UI using Layout tab, where we can also preview the work item template and decide where to place the field in the template UI. Workflow tab is used to define the states and transition for the work item and we can also add some the rules to the fields based on the stated of the work item, for example let us say all fields in the temple should be non-editable when state of the work item is Closed.


Let us create two fields named Tech Decision and Management Decision with both containing drop down values Approved, On-Hold, Rejected so that user can select value in the work item UI.

Click on New on the template editor



Fill in the data as below
Name: Tech Decision
Type: String
Reference Name: YourCompanyName.Common.TecDecision
Help Text: Technical Decision Approved, On-Hold or Rejected
Reportable: Dimension
Note: Reference name must contain minimum one period(.) and must not begin or end with period(.)

To add the list of values click on Rules then New


To add the list of values we can make of the rule ALLOWED VALUES and then Click OK


Below window will popup


Click on New.  And type Approved in the List Item box. Then click ok.



Again click on New to add one more list item Rejected.


And type Rejected in the List Item box. Then click ok. Follow above step to add one more list item On-Hold.

Click OK then OK.
Follow same steps as Tech Decision to and new field Management Decision with values Approved, On-Hold and then Rejected.



Now we can see the new fields in fields list of template.


By completing above steps we are just created the new fields Tech Decision and Management Decision with list values. Now let us see how to put these fields in the work item UI so that user can select the values. To edit the UI of the template we will make use of Layout tab.

Click on Layout tab.


Right Click on the Column just above the Group Status, then click on the New Group option to create new group named Decision.


Select the new group and at the right side provide Label value as Decision


When we create a group a default column will be added below, right click on the column to add the control

Enter below values for the attribute of the control and rest attributes we can leave as it is.
Label: Tech Decision
Field Name: YourCompanyName.Common.TechDecision


Again right click on the same colum and add new control give below details
Label: Management Decision
Field Name: YourCompanyName.Common.ManagementDecision


Now save the changes and template is ready to import. We ca also have preview of template before importing it to server. To have preview click on Preview Form button.



To import work item to server, go to TOOLS -> Process Editor-> Work Item Types->Import WIT

 Now browse for the Task.xml template and also select team project to which template has to be imported, click OK.


Open Team Explorer, click on Refresh button and then create new Task item from work items tile. And you should able to view Decision group with fields Tech Decision and Management Decision.