Archive for the ‘Uncategorized’ Category

TFS 2012 – Customize Backlog Pages

September 12, 2012 Leave a comment


Add New Field for Backlogs

Download agile process config file

witadmin exportagileprocessconfig /collection:http://tfsbox:8080/tfs/FirstCollection /p:CMMI-Test /f:"d:\tfs2012\AgileConfiguration.xml"

New Field To Add Dialog

Locate the AddPanel element and Iteration Path Element :



        <Field refname="System.Title" />

        <Field refname="Microsoft.VSTS.CMMI.RequirementType" />

        <Field refname="System.IterationPath" />



Upload config file to TFS Server

witadmin importagileprocessconfig /collection:http://tfsbox:8080/tfs/FirstCollection /p:CMMI-Test /f:"d:\tfs2012\AgileConfiguration.xml"


Notice that Iteration Path Field appeared in the Add Dialog



witadmin command-line tool can be found in below locations
cd %programfiles%\Microsoft Visual Studio 11.0\Common7\IDE

Note: For Windows 64-bit version…replace %programfiles% with %programfiles(x86)%

Add Work Item type as Backlog Item

By Default only Work items in “Requirements” category (defined in Collection Categories) can be added as Backlog item. If you want to add other workitems such as Bugs, Change Requests as Backlog Item…Here is the solution.

Download Categories

witadmin exportcategories /collection:http://tfsbox:8080/tfs/FirstCollection /p:CMMI-Test /f:"d:\tfs2012\categories.xml"

Add New WorkItems

Locate the CATEGORY element for the "Requirement Category" in categories.xml. By default (in CMMI process template) it has only one child for Requirement Workitem. Add Other workitems to the list. In the below code, I added Bug, Change Request, Task workitems.

<CATEGORY refname="Microsoft.RequirementCategory" name="Requirement Category">

  <DEFAULTWORKITEMTYPE name="Requirement" />

  <WORKITEMTYPE name="Bug" />

  <WORKITEMTYPE name="Task" />

  <WORKITEMTYPE name="Change Request" />


Upload Categories

witadmin importcategories /collection:http://tfsbox:8080/tfs/FirstCollection /p:CMMI-Test /f:"d:\tfs2012\categories.xml"


TF400916: The current configuration is not valid for this feature. This feature cannot be used until a Team Foundation Administrator corrects the configuration.


Add Microsoft.VSTS.Scheduling.Size and Microsoft.VSTS.Common.StackRank field to Change Request work item type of the team project.

Now you can add Change requests as Backlog



In the same way you can add “Issue”, “Bugs” work item type as well. But what about Tasks?

By Default Task work item is in “Task Category” and you can’t have an work item in both “Task category” and “Requirement category”. Also Backlogs are only for “Requirement category”

Hope this Helps…!

Categories: Uncategorized

Configuration Transformation in Windows/Console Apps

August 31, 2012 Leave a comment


If you are an ASP.NET Web Developer you might have seen the advantages of Web.Config Transformations. Here you can have separate Config files for each configuration defined in “Application Configuration Manager”

image image

But the Configuration Transformations are not supported for Windows Or Console Applications. But there is an work-around way to get it done. Lets see How it is…by Step by Step.



You can observe that this has only one App.Config file. Lets add two configuration files “App.Test.Config”, “App.Prob.Config”


Newly added files are at the Root Level of the Project instead of under App.Config file. See how they are defined in .proj file. (For this you need unload the project and Edit the Project File in Visual Studio)


Use DependentUpon  element to make “App.Test.Config”, “App.Prob.Config” files Childs to “App.Config” as  shows below…


Reload the Project and See the result


Let Add a connection String to the App.Config file.

<?xml version="1.0"?>



        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>




    <add name="MyConnString" connectionString="Data Source=.;Initial Catalog=MyDataBase_dev;Integrated Security=True" providerName="System.Data.SqlClient" />




Add Connection strings to Child Config files also… (with the change in database name MyDataBase_Prod, MyDataBase_Test)

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

<configuration xmlns:xdt="">


  <connectionStrings xdt:Transform="Replace">

    <add name="MyConnString" connectionString="Data Source=.;Initial Catalog=MyDataBase_Prod;Integrated Security=True" providerName="System.Data.SqlClient" />




To know more about the Transformation syntax refer below links

Now…Let Test it by Setting The Project Configuration to Test and Build…


If you look at the config file at bin\Test folder…you will find connection string same as “App.config” file.


Out of the box, .config file transformation is only available for Web application projects in Visual Studio 2010. Console, WinForms, WPF and other applications projects don’t support this capability out of the box.

What is the Work-Around? TransformXml Task

In this MSBuild code snippet, we are using the TransformXml task defined in the Microsoft.Web.Publishing.Tasks.dll. This is the task responsible for transforming Web.config files in Web application projects. It takes parameters that specify names of the original .config file, the transform file and the output (transformed) file. We use TransformXml task to override AfterCompile target if a transform file exist for the current build configuration. For example, if our project contains a file called App.Debug.config and the current project configuration is Debug, the AfterCompile target will be called. Finally, we use ItemGroup element to change the built-in AppConfigWithTargetPath item collection.

Add Below code to the Project file.

  <UsingTask TaskName="TransformXml" AssemblyFile="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll" />

  <Target Name="AfterCompile" Condition="exists(‘app.$(Configuration).config’)">

    <TransformXml Source="app.config" Destination="$(IntermediateOutputPath)$(TargetFileName).config" Transform="app.$(Configuration).config" />


      <AppConfigWithTargetPath Remove="app.config" />

      <AppConfigWithTargetPath Include="$(IntermediateOutputPath)$(TargetFileName).config">





That’s it….!

Build the project in Test Configurations and see the output @ bin\Test folder…!

Hope this Helps..Smile

Categories: Uncategorized

Query dbproj file to get list of database object

October 3, 2011 Leave a comment

Recently I got a requirement to parse database project to list down all procedures and tables etc.

I binged net for the solution and able to get the query finally.

SELECT @xml = CAST(xmlFile.BulkColumn AS XML)
FROM OPENROWSET(BULK 'D:\WorkArea\Projects\myDatabaseProject.dbproj' ,single_blob) AS xmlFile
IF OBJECT_ID('tempdb..#t') IS NOT NULL
drop table #t

build.value(‘@Include’,’nvarchar(1000)’) AS _path
into #t
FROM @xml.nodes(‘//ns:Build’) AS R(build)
IF OBJECT_ID(‘tempdb..#Result’) IS NOT NULL
drop table #Result
CREATE table #Result(fname varchar(1000), ftype varchar(100))
— Get Indexes
INSERT INTO #Result (fname, ftype)
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘index’ from #t WHERE _path LIKE ‘%.index.sql’
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘proc’ from #t WHERE _path LIKE ‘%.proc.sql’
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘table’ from #t WHERE _path LIKE ‘%.table.sql’
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘function’ from #t WHERE _path LIKE ‘%.function.sql’
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘view’ from #t WHERE _path LIKE ‘%.view.sql’
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘defconst’ from #t WHERE _path LIKE ‘%.defconst.sql’
SELECT reverse(left(reverse(_path), charindex(‘\’, reverse(_path)) -1)) as _name, ‘schema’ from #t WHERE _path LIKE ‘%.schema.sql’

select * from #Result where ftype = ‘table’

Similarly we can parse SSIS projects also. Script is as shown below.

SELECT @xml = CAST(xmlFile.BulkColumn AS XML)
FROM OPENROWSET(BULK 'D:\WorkArea\MySSISProject.dtproj' ,single_blob) AS xmlFile
IF OBJECT_ID('tempdb..#t') IS NOT NULL
drop table #t
Select'Name[1]','nvarchar(1000)') AS _path
FROM @xml.nodes('//Project/DTSPackages/DtsPackage') AS R(build)


Categories: Uncategorized Tags: ,

Rollback Changeset in TFS 2010

July 15, 2011 Leave a comment

Recently, I got a requirement to rollback changeset from TFS 2010. I referred some articles in the net. Below are some of them

Here I want to summarize the steps to rollback change sets in TFS 2010.

As described in above links, TF is a TFS command line tool available in “C:\ProgramFiles\Microsoft Visual Studio 10.0\Common7\IDE”. There are several arguments we pass to it. Among them /Changeset and /toVersion are mostly used arguments.

Syntax: tf rollback /changeset:C<n> <TFS BranchPath> /r — where <n> is the changeset number
How it works?: Removes the changes done as part of the <n> changeset.


Syntax: tf rollback /toVersion:C<n> <TFS Branch Path> /r –where <n> is the changeset number
How it works?: This will remove the changes done by all changesets after thespecified changeset.

For example, if you have change sets 1, 2, 3, 4. The command “tf rollback/changeset:C4” will remove the changes of Changeset 4. The command
“tf rollback /toVersion:C2” will remove the changes of Changesets 3,4 and leaves the at change set#2.

Points to remember:

  1. TFS Branch Path should
    be path to the branch ex: $/project/applicaitonFolder/branchFolder
  2. You need to run this TF command from the workspace folder.
  3. Open VS 2010 command prompt
  4. Go to the branch folder in your local disk
    Ex: D:\project\applicaitonFolder\branchFolder>tf rollback /toVersion:C123
    $/project/applicaitonFolder/branchFolder /r

On successful execution of TF Rollback, files will be checked-out in your workspace. You can check-in them to complete the rollback.


Categories: Uncategorized

TFS – Get Compare Results

January 25, 2011 Leave a comment

I need to export the Folder compare results to a text file. Command used for this is “tf folderdiff

Note: This command comes with VS2008, you can’t found in VS2005.
C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE>tf folderdiff /?
TF – Team Foundation Version Control Tool
Copyright (c) Microsoft Corporation.  All rights reserved.

Displays a visual representation of the differences between files in two server
folders, in a server folder and a local folder, or in two local folders.

tf folderdiff [sourcePath] targetPath [/recursive] [/noprompt]
              [/server:serverName:port] [/filter:filter]

tf folderdiff $/Project/MyApplication/Branch1/database $/Project/MyApplication/Branch2/database /login:myDomain\userName,myPassword /s:http://myTfsServer::8080 /view:different,sourceOnly,targetOnly /noprompt  /recursive > c:\result.txt

Very useful command.

Categories: Uncategorized

How to Test Emails during the Development?

January 25, 2011 Leave a comment

It is very common need to test whether Emails are going to recipients or not, during our development. But your development environment may not support to send the emails.
Below are  the few such environments.
Note: Here I am considering the developing .NET application, either WinForms, or WebForms.

  1. Using Windows XP system for developement.
  2. You don’t have IIS.
  3. You have IIS, but without SMTP server configuration.
  4. In case of ASP.NET web application, you are using ASP.NET Development Server (Cassini)

In such cases, the best workaround to test emails is – Configure an 3rd party SMTP server.
Coming to the point of interest for this post…that is SMTP4Dev ( It is a dummy SMTP server, sits in the system tray and does not deliver the received messages. The received messages can be quickly viewed, saved and the source/structure inspected. Useful for testing/debugging software that generates email.

How to use it?

Step#1: Download and install it. You will find it in the system tray

And below is its interface

Step#2: Configure (Domain name, IP, Port) and start listening

Step#3: Now, your SMTP server is ready. Before testing this, add configuration setting to web.config file.
        <network host=”localhost” port=”31” defaultCredentials=”true” enableSsl=”false”  />

Step#4: Below is the code snippet to test it.

SmtpClient mailClient = new SmtpClient();
MailMessage msg = default(MailMessage);
msg = new MailMessage();
msg.From = new MailAddress(“”);
msg.Subject = “TEST Subject”;
msg.Body = “TEST Message”;
msg.IsBodyHtml = true;

Step#5: Once it done, you will have the mail in SMTP4Dev window, as shown below…

Step#6: In this dialog, “Inspect”, “View” are useful commands.
Inspect, will shows you the inner details of the email (like… source, headers, body… )

And you can “View” the mail in Outlook client / Windows Live mail client.

We are done with Email testing during the development it self. Very useful and hope the same for you.
Also, there is one more alternative to test emails using deliveryMethod=”SpecifiedPickupDirectory”. Refer the below links…

– Pradeep.

Categories: Uncategorized

TFS – List out all changes between 2 dates

December 21, 2010 Leave a comment

List out all changes between 2 dates

  1. Need to use “C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\tf.exe”; Run it from command prompt.

Command:  “tf history -noprompt -server:<tfs server> <Project Path> -version:<Date1>Z~<Date2>Z -recursive -format:detailed -login:<UserName>,<Password> > c:\checkedout.txt”

Ex: tf history -noprompt -server:http://mytfs-server:8080 $/MyProject/Release/Dev2 -version:D2010-11-01T01:01:01Z~D2010-12-20T20:00:00Z -recursive -format:detailed -login:crm\pradeep,password > c:\checkedout.txt

Categories: Uncategorized