Sunday, 27 October 2013

TFS - Delete WIT Custom Fields Permanently


When you delete a custom filed from a Work Item Template and import is it really deleted from TFS fully? Or is it only hidden from that work item type and remains in TFS?

To find out the answer I have done a small experiment.

1. Fist I have added a new HTML type filed "CH.Test1" and added a HTML field control to User Story work item.



2. When I have imported the template I can see my new field in User Story work item.


3. I saved some data to newly created field.


4. Then I deleted the HTML field control and the filed "CH.Test1" in the template.


5. When viewed the previous user story I could not see the field and that is correct and field is deleted.


6. But what happens if I add the field again? To Investigate I tried adding the field with Same Reference Name but with a different name.



7. Import failed with

Error importing work item type definition:

TF26177: The field CH.Test1 cannot be renamed from 'Chaminda Test 1' to 'Chaminda Deleted And Added Field'.


8. This means that the field was not really deleted. To test I changed to the initial name "Chaminda Test 1"


9. Import was successful and when I viewed the same user story data I had entered before deleting the field was still available. It looked clear that even if I deleted a field from WIT template and import it did not delete the field or the data from TFS Collection.


8. Search in MSDN got me here Manage work item fields [witadmin]
I used witadmin listfields with Reference Name to see my field. The command gave the details of the field, whether it was used, In which project it was used.


9. Again I tried deleting from template and import.


10. When I used witadmin listfields with Reference Name, it clearly showed field is existing in collection but "Not In Use" in any team project.


11. How to delete permanently? I used witadmin deletefield with Reference Name, this gave me a warning and a confirmation question. When said Yes deleted. To verify I executed witadmin listfields with Reference Name again and an error shown that the field does not exist.


12. To confirm I tried re-adding the field with same Reference Name but with a different Name, and a different data type (String).



13. This time I did not get TF26177 when the template was imported.


Conclusion: When a field is deleted from the work item template and imported it remains in TFS collection and previously entered data related to work item also preserved. To delete the field permanently witadmin deletefield can be used and all data and the field will be completely destroyed with this command.

Tuesday, 15 October 2013

TFS 2013 RC - Rename Work Item Type

How can I rename a Work Item Type in TFS? Is it impossible? Answer is yes you can rename and it is very simple to do it.

Here is the steps you need to do.

Open up the VS Developer Command prompt (If using TFS 2012 use VS 2012 developer command prompt, for TFS 2013 RC use VS 2013 RC command prompt)

  • First list all work item types with the below command
witadmin listwitd /collection:YourTfsServer/VirtualDirecory/TeamProjectCollection /p:YourTeamProject

Example
witadmin listwitd /collection:http://localhost:8080/tfs/DefaultCollection /p:Scrum3RenameTest

  • Then rename the work item type using
witadmin renamewitd /collection:YourTfsServer/VirtualDirecory/TeamProjectCollection /p:YourTeamProject /n:FromWorkItemTypeName /new:ToWorkItemTypeName

Example
witadmin renamewitd /collection:http://localhost:8080/tfs/DefaultCollection /p:Scrum3RenameTest /n:"Feature" /new:"Epic"


I renamed the Feature to Epic. Now when I try to view the backlog in Web Access Below error shows up. TF400917: The current configuration is not valid for this feature



Reset IIS by running resetiis on the command prompt and you are good to go!


Now my Feature work item renamed to Epic and I can add new Epic work items. that is cool...But.. :(

Why but? Still the Menu in left says Features? Can I change that?

Lets see how we can do this change?

Export the ProcessConfiguration xml with below command

witadmin exportprocessconfig /collection:YourTfsServer/VirtualDirecory/TeamProjectCollection /p:YourTeamProject /f:FileNameWithPath

Example
witadmin exportprocessconfig /collection:http://localhost:8080/tfs/defaultcollection /p:Scrum3RenameTest /f:"C:\temp\ProcessConfiguration.xml"

Then open the .xml file in a notepad and change Plural Name  and Singular Name for Feature Category.

After the change import xml with below command (I copied xml and renamed as ProcessConfigurationmodified.xml)

witadmin importprocessconfig /collection:YourTfsServer/VirtualDirecory/TeamProjectCollection /p:YourTeamProject /f:FileNameWithPath

Example
witadmin importprocessconfig /collection:http://localhost:8080/tfs/defaultcollection /p:Scrum3RenameTest /f:"C:\temp\ProcessConfigurationmodified.xml"


Refresh web access

Above message is completely OK, just click on Epics

Now this is really cool.. :)

Thursday, 10 October 2013

TFS 2012/2013 - Different Layouts for Work Items in Web Access and VS/Team Explorer

Have you ever thought of having a different layout for a given work item in TFS Web Acess & inside Visual Studio/Team Explorer? Is it possible? Yes. It is. Let me show you how.

I am trying to have different layout for my User Story work item.

First I download the UserStory template xml using power tools.


Now for folks who are used to do TFS customizations only with power tools..Hey this not going work that way..You need to have a bit of a  XML here.

Open the downloaded UserStory.xml file (for safety I keep original and use a copy of UserStory.xml as UserStoryModified.xml)

Go to the  Form node and copy the Layout node content and paste it between Form xml tags

Then Add attribute Target to each of the Layout node "WinForms" for Visual Studio/Team Explorer, "Web" for Web Access layout.



Important: If you have used Name attribute in any nodes of the duplicated Layout node content make sure the "WinForms" and "Web" layouts have different names defined for example like below.



Now we can customize the layouts as we would like it to appear in Web Access & within Visual Studio or Team Explorer. (Again if you try to open this with TFS power tools you will only see the Layout which is in top. So you have to do this in xml :) )

 For Visual Studio/ Team Explorer

For Web Access



After importing UserStoryModified.xml with power tools,

User Story in Visual Studio/Team Explorer



Same User Story in Web Access


Cool isn't it?

For more info check below

Specifying Different Layouts for Different Targets
Design the Layout of the Work Item Form


Wednesday, 9 October 2013

TFS - Adding HTMLFeildControl to Work Item

There are two important points to consider if you are adding HTMLFeildControl to a work item.

1. First You need to have the correct type for the field that you are adding. HTML is the type that works for HTMLFeildControl.




To illustrate I have added three fields, two having type HTML and one having plain text. See the behaviour of the "PlainText" type field on a HTMLFieldControl. It does not give the HTML field control editiong options and notifies an error with color.



2. Use MinimumSize attribute

Tip from MSDN 

"When you add several HTMLFieldControl elements on a form that will be stacked vertically, you should specify the MinimumSize attribute for each field control. In this manner, you can make the text boxes all a similar size. Otherwise, the last HTML control element is sized to fill the form, and the previous elements appear together with smaller text boxes."

For more information refer Control the Display of Work Item Fields: Adding Formatted Text Fields


Friday, 4 October 2013

Backlog Priority - How it works

I was trying to answer a question posted in MSDN forum and to explain how Microsoft.VSTS.Common.BacklogPriority works. I have done a small test cycle. Thought worth sharing it here for everyone's benefit.

Test 1: I created PBI through web access just providing Name and click add in Backlog.
Test 2: I create PBI with web access going to Queries-->New-->PBI
Test 3: Changed Microsoft.VSTS.Common.BacklogPriority manually.

See how it behaves..and hope you will have a clear understanding of  Microsoft.VSTS.Common.BacklogPriority. In terms of usage you can go through this MSDN article.






Thursday, 3 October 2013

ALM with VS & TFS 2013 - Overview Session - Sri Lanka .Net User Group

I did an overview of ALM with VS & TFS 2013 session @ Sri Lanka .Net User Group today. Crowd seem to be enjoying the details.. :)

It was an awesome experience for me to try out the TFS 2013 & VS 2013 RC. For doing this session got lot of inspiration from





Tuesday, 1 October 2013

TFS 2013 - Power Tools Now Available

Good news! TFS 2013 Power Tools are available @ http://visualstudiogallery.msdn.microsoft.com/f017b10c-02b4-4d6d-9845-58a06545627f and even VS 2005 version control compatibilty (TFS 2013 MSSCCI Provider for VS 2005) is also available @ http://visualstudiogallery.msdn.microsoft.com/06c8e056-7f77-4a5c-9b8b-49318c143df8

Still 64 bit version of TFS 2013 MSSCCI Provider for VS2005 not available but will be available sooner @ http://visualstudiogallery.msdn.microsoft.com/22d38324-051c-4f04-9379-ff78e7116c8d

If you come across the error
"The Windows Shell Extension component cannot be installed side-by-side with previous versions. In order to continue, you must deselect that feature, or cancel this installation, uninstall the previous Windows Shell Extension, and restart this installation."





while installing TFS 2013 Power Tools you can folow the steps I have specified to get the installation going.

1. Go to control panel -> Uninstall a Program and look for the latest TFS Power Tools version that you have installed. In my case it is TFS 2012 update 2 power tools. Click on change.


2. Select Modify in the wizard




3. Remove Window Shell extension feature and proceed.




4. Now retry installing TFS 2013 Power Tools




7. Reboot your machine.

8. All good and your TFS 2013 Power Tools are good to go with VS 2013 RC




Friday, 20 September 2013

TFS - How to Restore Deleted Files

Have you ever wanted to find a deleted file in TFS and Restore/Undelete it? Is it possible? Yes. It is. Let me show in few quick steps how you can restore a deleted file in TFS using Visual Studio Source Control Explorer.

1. Your VS Source Control Explorer would normally look like below and will not show the deleted files.


2. Go to Tools --> Options in Visual Studio menu and open the options. Select Source Control --> Visual Studio Team Foundation Server and tick the option "Show deleted items in Source Control Explorer" and click OK.

  

3. Now you can see the deleted files appear in Source Control Explorer. Right click on the Folder/File you want to restore and click "Undelete" to get it restored.



Popular Posts