A Django site.
May 15, 2008
» TSWA tip: How to use the new TSWA template URL feature (initial value URL)

One of the new features we've added to TSWA for the SP1 release is the ability to create URLs that are effectively work item templates by virtue of the fact that they have the values for the work items embedded in the URL itself.

Since constructing these URLs manually is really painful, we have an icon on the work item editor when you are creating a new work item that creates the URL and places it in the Windows clipboard.

Bring up the new work item form, fill in whatever values you want to get automatically set each time you use the URL, and then click the "globe with chain link" icon below the Save button.

image

Then you’ll get a pop-up message like this letting you know the template URL is now in the clipboard.

image

When you paste the contents of the clipboard, you'll get a link like this.

http://myserver:8090/UI/Pages/WorkItems/WorkItemEdit.aspx?pname=Orcas&wit=Orcas%20Bug&[System.Title]=Bug%20Bash%3A&[System.AreaPath]=Orcas%5CBuild%5CTeam%20Build&[System.IterationPath]=Orcas%5CRosario%5CBeta&[Microsoft.VSTS.Dogfood.IssueType]=Code%20Defect&[Microsoft.VSTS.Common.Severity]=2&[Microsoft.VSTS.Common.Priority]=2&[Microsoft.VSTS.Common.OpenBuild]=21022.08&[Microsoft.VSTS.Dogfood.OpenedBranch]=Orcas%20RTM&[Microsoft.VSTS.Dogfood.HowFound]=Dogfooding&[Microsoft.VSTS.Dogfood.Source]=Development&[Microsoft.VSTS.Dogfood.ProductUnit]=TFS&[Microsoft.VSTS.Dogfood.TeamLevel1]=Team%20Build&[Microsoft.VSTS.Dogfood.Blocking]=Not%20Blocking

That link will create a new Orcas Bug work item in the Orcas team project that I can use to quickly file a bug on the TFS Build feature.

  • Title starts with "Bug Bash:"
  • Area Path is "Orcas\Build\Team Build"
  • Iteration Path is "Orcas\Rosario\Beta"
  • Issue Type is "Code Defect"
  • Severity is "2"
  • Priority is "2"
  • Build is "21022.08"
  • Branch is "Orcas RTM"
  • How Found is "Dogfooding"
  • Source is "Development"
  • Product Unit is "TFS"
  • Team Level 1 is "Team Build"
  • Blocking is "Not Blocking"

With all of that filled in automatically, all I need to do after clicking the link is fill in the Description and Repro Steps.  That's a lot faster!

Previous tip: TSWA tip: Copy a bug to quickly file a new bug in an area related to the original

April 10, 2008
» Team System Web Access 2008 SP1 CTP and Work Item Web Access 2008 CTP are now available

Hakan has announced the availability of the new TSWA community technology preview (CTP) in his post, What's New in TSWA 2008 SP1.  Personally, I would say this release is beta quality or better, so don't let the CTP designation scare you too much.

Also released is the first CTP release of what we are calling Work Item Web Access (WIWA).  You may recall that we published a spec for it recently, referring to it as a "bug submission portal."  WIWA provides you with the ability to have folks create work items and view work items they have created without needing a client access license (CAL) for 2008.  This was a new condition that was added to the TFS 2008 license agreement.  Hakan has more details in his post on WIWA.

Both the CTP of TSWA and the CTP of WIWA have the same requirements as the previous release of TSWA 2008 (e.g., you must have Team Explorer 2008 installed as a prerequisite).

This release of TSWA has some really great new features.

  • Single instance with multiple languages
  • Support for specifying field values in the URL for creating new work items (works in both TSWA and WIWA)
  • Share ad-hoc work item queries
  • Shelveset viewer
  • Improved search support

I want to call out two features in particular that I really like.

Support for specifying field values in the URL for creating new work items (works in both TSWA and WIWA)

How often have you wanted users or testers to file bugs and needed to have them fill in certain fields with particular values so that the work item shows up in the correct area?  We now support providing field values in the new work item URL.  Here's the example that Hakan provided.

http://<server>/wi.aspx?pname=MyProject&wit=Bug&[Title]=Bug Bash&[AssignedTo]=Hakan Eskici&[Iteration Path]=MyProject\Iteration2&[FoundIn]=9.0.30304

This will open a new work item editor window with the following initial values:

  • Team Project = MyProject
  • Work Item Type = Bug
  • Title = Bug Bash
  • Assigned To = Hakan Eskici
  • Iteration Path = MyProject\Iteration2
  • Found in Build = 9.0.30304

Now you can start sending your users and testers a link with all of this already filled in!

Improved search support

Have you ever wanted to search for bugs assigned to someone in particular or in a particular area without writing a query?  In the past, you could only search the Title and Description fields in a work item, which I described here.  Now you can enter the following into the search box in TSWA to find any bug assigned to me that also has the word "exception" in the Title or Description.

exception a="Buck Hodges"

The core fields have shortcuts.  Any field can be used by specifying the reference name for the field.  Here's the equivalent without using the shortcut.

exception System.AssignedTo="Buck Hodges"

Here are the shortcuts for the core fields.

  • A: Assigned To
  • C: Created By
  • S: State
  • T: Work Item Type

You can use TFS macros, such as @me, in search.  For example, find all work items containing "watson" in the Title or Description that are assigned to me that are in the Resolved state and are work items of type Bug.

watson a=@me s=Resolved t=Bug

Now, if you really want to do something cool, there are the "contains" and "not" operations.  The "=" operator matches exact phrases, whereas the ":" operator is used for "contains" clauses.  The following search looks for bugs assigned to Active (i.e., not assigned to any particular person yet) where the word "repro" is contained in the History field.

a=Active History:repro

This example illustrates the difference between the two operators.  The first example finds all work items where the Title is exactly "Bug Bash" with no other words or characters in it.  The second example, which uses the contains operator (colon) rather than the exact match operator (equals), finds all bugs where the Title contains the phrase "Bug Bash" along with any other words or characters.

  • Title="Bug Bash"
  • Title:"Bug Bash"

Personally, I find myself almost always using the contains operator.

Finally, you need to be able to exclude certain things from your search.  For that, there is the not operator, which is represented by the hyphen ("-").  The following example finds all work items with "watson" in the Title or Description fields that are not assigned to me and that are not closed.

watson –a=@me –s=closed

The not operator only works with field references, so you can’t use the following to find all work items containing "watson" but not containing "repro" in the Title and Description fields.

watson –repro

However, you can accomplish this by specifying the Title field explicitly with the not operator.

watson –Title:repro

Please send us your feedback on both the new features and Work Item Web Access!

February 13, 2008
» Team Foundation Build 2008 API documentation

The documentation for the team build 2008 object model is now available as a CHM file.  Later this year, I'm told that the MSDN web site will be updated.

http://download.microsoft.com/download/5/f/8/5f872c2e-4221-410b-b86e-4c3cd831b0c4/Team Foundation Build Managed Reference.chm

After you download it you will need to right click it, choose Properties, and then select “Unblock” before you can view it.

This documentation is newer than what Aaron posted back in August.

The following are posts with examples of using the 2008 object model.

January 31, 2008
» Visual Studio Team System Web Access 2008 in Japanese is now available

Part of our plan for the TSWA 2008 Power Tool is to release localized versions.  Japanese is the first language to become available.  Chinese, German, Spanish, French, Italian, and Korean are currently planned for release over the next month.

Here's the download page in Japanese, along with a link to it.

Team System Web Access (??? TeamPlain) ??Visual Studio 2008 Team Foundation Server ? Web ??????????????

??

Team System Web Access 2008 ???????????????Team System Web Access 2008 ??Team Foundation Server ???????????????????????Team System Web Access 2008 ???? Team Foundation Server ??????????Team Foundation Server ????????????????????????
??

  • ??? : ?????????????????????????????
  • ??? : ??????????????? ?????????
  • ??? : ?????????????????????????????????
  • ?????????????????????
  • ???????????????????????????
  • ???????????????????????????
  • SharePoint ??? ????????????????????????????????????????????
  • ????????PDF ????? Excel ??????????
  • ??????????????????????????????????????????????????
  • ????????????????????
  • ?????????????????

December 1, 2007
» Video on the new features in Team Foundation Build 2008

There's a great new video on the MSDN web site by Richard Hundhausen that goes over the new features in Team Foundation Build 2008.  It's one of the featured videos this week.  The video covers the major new features and provides a great introduction to the product.

How Do I: Learn the New Features and Capabilities of Team Foundation Build 2008?

In this video, Richard Hundhausen explores the new features and capabilities of Team Foundation Build 2008, including defining and managing build definitions, agents, qualities, and retention policies.

Presented by Richard Hundhausen on November 20, 2007
Length: 14 minutes 33 seconds

 

Video Downloads:

ZIP | WMV | iPod | MP4 | 3GP | Zune | PSP

You can find more Visual Studio Team System videos at "How Do I?" Videos for Team Suite.

November 30, 2007
» Team System Web Access 2008 Power Tool is now available

Today we have released the final version of the Team System Web Access (TSWA) 2008 power tool!  Team System Web Access provides a web interface to Team Foundation Server 2008.

Here's a list of feature changes.  Of course, we also fixed a number of bugs.

  • New direct links: Previously, you could construct a direct link to a work item (http://mytfs:8090/wi.aspx?id=123).  Now you can also construct direct links to more features, and the direct links no longer open the main TSWA page, making them more responsive.  Keep reading to find out how to use them.
  • Performance improvements: The code now uses server memory more efficiently, resulting in increased performance.
  • Custom work item controls: First introduced in the CTP, we have continued to refine support for custom work item controls in TSWA.  To take advantage of this feature, you'll need to implement web versions of your existing custom controls.  You'll find documentation for it in the SDK folder underneath the folder where you install TSWA.  The following examples have been added since the CTP, in addition to the samples for checkbox, a work item picker, and a multi-value selector.
    • How to validate a work item on the client-side (Javascript)
    • How to validate a work item on the server-side
    • How to design a control whose field depends on the values of other fields
    • How to design a control that changes other field values (such as the WI state) and saves the work item
  • Team Build 2008 support: Also introduced in the CTP, you can view the build queue and queue new builds, which are features that are new for TFS 2008.

For those of you who remember the need for the TSWA users group in the installation of the TSWA 2005 power tool, you'll be happy to know that is gone.  That was something we had to add to satisfy security requirements, but we've since changed the code to handle the impersonation better such that impersonated user identities no longer need access to any of the local directories for cache files and user settings (i.e., the code reverts to the service account while it accesses those).

Note that you need to install Team Explorer 2008 on the computer before installing TSWA 2008.

Direct Links

Here is the list of direct links and examples showing how to construct them.  The previous releases only supported direct links to work items, and Neno Loje has a great post on how to modify work item alert emails to use TSWA links.  The new direct links, such as diff, provide the ability to make the checkin email alerts really useful, too (more on that later).

  • Work item tracking
    • Work item editor
      • Open the existing work item with ID 1234: http://mytfs:8090/wi.aspx?id=1234 
      • Create a new work item of type Bug in team project TeamProject:  http://mytfs:8090/wi.aspx?pname=TeamProject&wit=Bug
    • Query editor
      • Open the query editor to create a new query: http://mytfs:8090/qe.aspx?pname=TeamProject
      • Edit the existing public query (under "Team Queries") called "Team Bugs" (scope is either public or private, which corresponds to Team Queries or My Queries, respectively, in English systems): http://mytfs:8090/qe.aspx?pname=TeamProject&name=Team%30Bugs&scope=public
    • Query results
      • Execute the private query (under "My Queries") called "My Bugs": http://mytfs:8090/q.aspx?pname=TeamProject&name=My%30Bugs&scope=private
  • Version Control
    • Changeset details
      • Display the details for changeset 1234 by specifying the changeset number: http://mytfs:8090/cs.aspx?cs=1234
      • Display the details for changeset 1234 by specifying the artifact URI: http://mytfs:8090/cs.aspx?csuri=vstfs:///VersionControl/Changeset/1234
    • History
      • Display the version history of the file or folder identified by item ID 789: http://mytfs:8090/history.aspx?item=789
      • Display the version history of the file $/TeamProject/Secret/foo.cs (specify del=N where N is the deletion ID if the file is deleted): http://mytfs:8090/history.aspx?path=$/TeamProject/Secret/foo.cs 
      • Display the version history of the directory tree at $/TeamProject/Secret (history of a folder is recursive; specify del=N where N is the deletion ID if the folder is deleted): http://mytfs:8090/history.aspx?path=$/TeamProject/Secret 
    • Compare files (diff)
      • Display the differences between the latest version of two different files, identified by item IDs 789 and 3456 ("o" indicates the original version that will be displayed on the left, and "m" indicates the modified version that will be displayed on the right): http://mytfs:8090/diff.aspx?oitem=789&mitem=3456
      • Display the differences between two different versions of the same file, identified by item ID 789 and changesets 100 and 200: http://mytfs:8090/diff.aspx?oitem=789&ocs=100&mitem=789&mcs=200
      • Display the differences between the latest version of two different files, identified by path (specify del=N where N is the deletion ID if the file is deleted): http://mytfs:8090/diff.aspx?opath=$/TeamProject/Secret/foo.cs&mpath=$/TeamProject/SecretBranch/foo.cs 
      • Display the differences between two different versions of the same file, identified by path and changesets 100 and 200 (add the appropriate deletion ID, odel=N or mdel=M, for deleted files): http://mytfs:8090/diff.aspx?opath=$/TeamProject/Secret/foo.cs&ocs=100&mpath=$/TeamProject/SecretBranch/foo.cs&mcs=200
    • View file
      • View the contents of the file identified by the item ID 789: http://mytfs:8090/view.aspx?item=789
      • View the contents of the file $/TeamProject/Secret/foo.cs (specify del=N where N is the deletion ID if the file is deleted): http://mytfs:8090/view.aspx?path=$/TeamProject/Secret/foo.cs
    • Annotate (blame)
      • Display an annotated view of file $/TeamProject/Main/foo.cs (specify del=N where N is the deletion ID if the file is deleted): http://mytfs:8090/ann.aspx?path=$/TeamProject/Main/foo.cs
      • Display an annotated view of file $/TeamProject/Main/foo.cs up until changeset 123 (specify del=N where N is the deletion ID if the file is deleted): http://mytfs:8090/ann.aspx?path=$/TeamProject/Main/foo.cs&cs=123
      • Display an annotated view of file identified by item ID 789: http://mytfs:8090/ann.aspx?item=789
      • Display an annotated view of file identified by item ID 789 up until changeset 123: http://mytfs:8090/ann.aspx?item=789&cs=123

I've started a series of posts called TSWA Tips to help folks get the most out of Team System Web Access.

Enjoy!

November 26, 2007
» TSWA tip: Copy a bug to quickly file a new bug in an area related to the original

Like Team Explorer, Team System Web Access does not support work item templates yet (though you can get a power tool work item template add-in for Team Explorer 2005 -- look for power tools for TFS 2008 in December).  However, you can use the "Create Copy of Work Item" feature to copy a work item that's similar to the one you want to file.  Then you only need to change the information that's different for the new bug and save it.

To do this, click the triangle beside the work item you want to copy and choose "Create Copy of Work Item" from the popup menu.  This particular feature is not available from the Tools menu on the tool bar, unlike "Add Related Work Item" which shows up in both places.

image

Clicking on "Create Copy of Work Item" will present you with a list of team projects.  The list of work item types are shown in the next menu when you click on a team project.

image

Once you choose the work item type, the new work item will open in a new window with all of the fields filled in from the original work item (if you choose a different work item type than the original, only fields that appear in the original will be filled in for the new work item).  Change the fields that need to be different and save the work item to finish creating the new one.

Previous tip: TSWA tip: Send an email with a work item or query results

November 12, 2007
» TSWA tip: Send an email with a work item or query results

Let's say you're going through your bugs and want to ask someone a question about one of them.  You can use Team System Web Access to send that person an email containing all of the work item's information and a link to it.

To email a work item, open the work item in TSWA.  Go to the Tools menu shown below and choose Send as Email.

image

You'll get a new window where you can enter the person's full email address and type a message.  The message body contains a link to the work item in Team System Web Access and all of the work item's fields and contents.

image 

You can also email query results.  As with the work item above, go to the Tools menu and choose Send as Email.

image

You'll then get a similar email window that contains the results of the query and a link so that the email recipient can run the same query.

image

Enjoy!

November 9, 2007
» TSWA tip: Search bugs and reports

Have you ever wanted a quick way to find the bugs containing some word?  Team System Web Access comes to your rescue.

In the upper left corner underneath the team project selector, there is a search box.  Type in a word and hit Enter.  If you want to search for a phrase rather than a single word, simply enclose it in quotation marks (e.g., "team build" or "team foundation server").  Without the quotation marks, you'll be searching for all work items having all of those words (e.g., entering "team build" without quotation marks finds all work items containing both the word "team" and the word "build" rather than just the phrase "team build").

Here I'm searching for all work items containing the word "tfsbuild" that are in the Orcas team project.  This will find tfsbuild, tfsbuild.exe, tfsbuild.proj, etc.

image

Here are the results.  In this case I've found 65 bugs.  Had there been any reports containing that word in the title or description, each would have been listed as well (e.g., we have 17 reports in Orcas containing the word "feature").

In case you are thinking that it's only searching the titles, I've highlighted two work items below that don't have the term "tfsbuild" in the title but do contain it in another field (Repro Steps or History, in this case).

image

Enjoy!

[Update 11/9/07]  I've corrected the difference between searching for a phrase in quotation marks and a set of words in a work item.

November 7, 2007
» TSWA tip: Bulk edit

Sara Ford has a Visual Studio Tip of the Day series going.  I thought I'd publish some tips on using Team System Web Access, and this is the first.  I don't think I'll be able to do a tip per day.  Calling it a "TSWA tip a few times a week" just doesn't sound that great.  So I'll just leave it as TSWA Tips.

In the regular Team Explorer (aka Team Foundation Client), you can't edit work items in bulk except by exporting them to Excel (at least as of Team Explorer 2008).  However, you can do this using Team System Web Access.

First, select the work items that you want to edit in bulk by clicking the checkbox beside each.  I've selected five bugs below.  Then, select Bulk Edit -> Edit Work Items from the drop down menu near the upper right hand corner (or upper middle, depending on how wide your window is).

image

Now you are presented with a window where you can edit the core fields of a work item.  While this is not as flexible as defining the fields to edit like you can using a custom query and exporting to Excel, it's really convenient.

Here they all have a State of Closed, and I'm changing all of the bugs to be assigned to Closed (they were previously assigned to me).  When you click Save, you will see the progress as each work item is updated.

image

And I've just noticed that we didn't catch the fact that "successfully" is misspelled.  I'll file a bug on that. ;-)

September 21, 2007
» Preview of the build notification tray applet power tool for TFS 2008

[UPDATE 9/21/07]  My original attachment contained a delay-signed binary.  I've attached a new ZIP file containing one that does not have that problem.  I've also updated the path where BuildNotification.exe must be placed to get all of the features to work.

We would have loved to have included in TFS 2008 a build notification tray applet along the lines of CCTray for CruiseControl.  However, we didn't have the time in the schedule to do it.  As a result, we're going to be releasing one as a power tool.

You may remember seeing the spec for this on Jim Lamb's blog.  Swaha Miller, a developer on Team Build, implemented this tool, and I've attached the binary to this post to provide a preview and get your feedback.  Disclaimer: Please note that this is not official software, has bugs, may burn up your computer, etc.  In other words, you accept full responsibility for it if you choose to run it.

To install it, simply copy BuildNotification.exe to C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies and run it (you must have Team Explorer 2008 Beta 2 or newer installed for the applet to work).

When you run it, you'll see a balloon tip in your system tray (I have my taskbar docked to the right-hand side of my screen).  The applet automatically configures itself to run when you log into your computer.  Don't worry, though.  You get the option of removing that if you shut down the applet.

Start up balloon

When you click on the balloon, you'll be able to select which build definitions you would like to monitor.  The list of servers is retrieved from the registry location that Team Explorer stores them.  If you've never used Team Explorer before, there won't be any servers listed.

Here I'm going to monitor the HelloworldTest builds in the VSTS V2 Plans team project.  You can monitor as many builds as you like and on multiple servers, but I'm just monitoring one build.  I've chosen to be notified when a build is started and finished, regardless of who kicked it off.  Note that you can filter the build definitions if you have a lot to deal with.

Configure Build Notifications

It turns out that the last time this build executed, it was successful.  You'll notice the tray applet's icon has a green circle with a check mark in it.

Last build was good

Let's kick off a new build and see what happens.  Here's the notification that the build is starting.  The Stop Build link on the "toast" window allows you to stop the build, if you don't want it.  For those of you paying really close attention, you'll notice that this is the .3 build.  I missed capturing a screen shot earlier.

Build started notification

Meanwhile, the tray applet's icon changes to show a green triangle "playing" icon, indicating a build is in progress.

Build is in progress

When the build completes, you can see that I've broken the build.  By either right-clicking on the window or clicking on the little triangle in the upper right corner, you can view the build details in a web browser.  It turns out that the drop location that I specified didn't exist.

Build failed notification

Now the applet's icon shows a red circle with an 'X' in it, indicating that the last build is broken.

Last build was broken

If you want to learn more about this build, you can double click on the tray applet's icon to pop up the following window.  If you right click on the build, you'll get options to view the details in a web browser, delete it, etc.

Current Build Status

I fixed the drop share problem and ran the build again.

Build partially succeeded notification

As you can see, the build was only partially successful.  What went wrong?  Well, it's something many of you have experienced.  The compilation succeeded, but the test failed because Visual Studio Team System for Testers isn't installed on the build machine!  We have plans to make installing the unit test framework on your build server much easier in the release after TFS 2008.

We hope you enjoy using this build notification tray app.  Please let us know what you like and dislike and what features you would like to see in the next version by posting your comments here.

Enjoy!

September 11, 2007
» VSTS 2005 and 2008: Building Database Projects with Team Build

Jon Liperi, a tester on Team Build, has put together the post below that explains a number of the issues around using Visual Studio Team Edition for Database Professionals (DBPro) with TFS Build.  Jon previously worked on the DBPro team, so he knows his way around it quite well.  Here are the issues that he covers.

  • Issue #1: Team Build service account does not have the required SQL Server permissions or cannot connect to SQL Server
  • Issue #2: Values for TargetDatabase, TargetConnectionString, or DefaultDataPath are missing or incorrect
  • Issue #3: The New Build Definition dialog does not provide a “Default” configuration option
  • Issue #4: The Deploy target is not invoked when built via Team Build
  • Issue #5: Database Unit Tests cannot find database project files, data generation plans, or the database instance(s) to be used for running tests when run via Team Build

This information applies to both the 2005 (8.0) and the 2008 (9.0) versions of VSTS and TFS.

Building Database Projects with Team Build by Jon Liperi

Recently, we have seen more questions about building database projects with Team Build. It is absolutely possible to build these project types with Team Build. However, you’ll need to have VSTE for Database Professionals (aka DBPro) and SQL Server installed on the build agent. There are also several known issues. In this blog post, I’ll describe these issues and their workarounds. Please let me know if there are additional issues you encounter or if the work-around steps need a bit of correction by commenting on this blog entry or posting on the Team Build forum:

http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=481&SiteID=1

To start, I’ll point you to a few links specific to database projects, including some existing documentation around Team Build integration.

Visual Studio Team System Database Edition (MSDN documentation)
http://msdn2.microsoft.com/en-us/library/aa833253(VS.90).aspx

How to: Deploy Changes using Team Foundation Build (MSDN documentation)
http://msdn2.microsoft.com/en-us/library/aa833289(VS.90).aspx

Visual Studio Team System - Database Professionals Forum
http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=725&SiteID=1

Issue #1: Team Build service account does not have the required SQL Server permissions or cannot connect to SQL Server

Database projects create a scratch database on the local SQL Server instance when building. Therefore, the build will fail if the Team Build service account does not have the appropriate permissions on the SQL Server instance running on the build machine. You may see an error message similar to the one below in the build log:

The "SqlBuildTask" task failed unexpectedly.

Microsoft.VisualStudio.TeamSystem.Data.Common.Exceptions.DesignDatabaseFailedException: You have insufficient permissions to create the database project. For more information, see the product documentation.

To resolve this issue, grant the required SQL Server permissions to the Team Build service account. In Orcas, the Team Build service runs by default as NT AUTHORITY\NETWORK SERVICE. A quick way to fix this is to create a SQL login for the service account that has sysadmin privileges. However, if you want to grant only the minimal permissions, detailed SQL Server permissions for DBPro are described here:

http://msdn2.microsoft.com/en-us/library/aa833413(vs.90).aspx

Additionally, you may need to ensure that a necessary registry key, which points to the local SQL Server instance to use for build, exists on the build machine. To configure the build account’s HKCU hive to point to the correct instance, you can either:

  1. Start the Visual Studio IDE as that user. Set the instance name by opening Tools | Options and navigating to Database Tools | Design-Time Validation Database.
  2. Run the following command from a command prompt.
    (Note: You may need to replace 9.0 with 8.0 depending on the version of DBPro you are using.)

    runas /user:<Team Build service account> "REG ADD HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\DBPro\DialogPage\Microsoft.VisualStudio.TeamSystem.Data.DBProject.Settings.DataConnectionOptionsSettings /v DefaultSqlServerName /d <instance name>"

    The value for <instance name> is just the name of the instance. For example, if the instance is “.\SQLEXPRESS”, replace <instance name> with “SQLEXPRESS”. If it is an unnamed instance, enter an empty string.

Issue #2: Values for TargetDatabase, TargetConnectionString, or DefaultDataPath are missing or incorrect

Database projects store any non-default values for the TargetDatabase, TargetConnectionString, and DefaultDataPath properties in a <ProjectName>.dbproj.user file which is not checked into version control (as the values may be different for each user). Therefore, these values are missing when built via Team Build resulting in the following error message:

TSD257: The value for $(DefaultDataPath) is not set, please set it through the build property page.

To build successfully from Team Build, you must either:

  1. Copy these properties from the <ProjectName>.dbproj.user file and add them to the <ProjectName>.dbproj file for the configuration that you want to build.
  2. Pass these properties as MSBuild command line arguments by entering them in the Queue Build dialog (Orcas only) or by storing them in the TFSBuild.rsp file. For example:
    /p:DefaultDataPath=<path>; TargetDatabase=<databaseName>;AlwaysCreateNewDatabase=true;TargetConnectionString="<connection string>"

Issue #3: The New Build Definition dialog does not provide a “Default” configuration option

Database projects do not define Debug or Release configurations. They only define “Default”. When creating a new build definition, you may notice that the only listed options are “Release” and “Debug”. To work-around this, you can either:

  1. Manually type in “Default” in the dialog.
  2. Ensure the “Release” and “Debug” solution-level configurations are set to build the “Default” configuration of the database project.

Issue #4: The Deploy target is not invoked when built via Team Build

The default target executed by MSBuild is Build. Therefore, database projects may not deploy by default when built via Team Build. To invoke the Deploy target from Team Build, you must either:

  1. Ensure your solution configuration is set to invoke both the Build and Deploy targets on the database project.
  2. Override AfterDropBuild to explicitly invoke the Deploy target. Instructions for overriding Team Build targets can be found at:
    http://msdn2.microsoft.com/en-us/library/aa337604(VS.90).aspx
  3. Modify the TFSBuild.proj file to list the individual projects to build and their targets instead of listing the entire solution. For example:
    <SolutionToBuild Include=”foo.dbproj”>
    <Targets>Build;Deploy</Targets>
    </SolutionToBuild>
  4. Edit the .dbproj file to make the DefaultTargets in their dbproj file Build;Deploy. For example:
    <Project DefaultTargets=”Build;Deploy”...>
    This would apply outside of Team Build as well, but it would have the desired effect.

Issue #5: Database Unit Tests cannot find database project files, data generation plans, or the database instance(s) to be used for running tests when run via Team Build

Database unit tests provide the ability to deploy a database project and/or run a data generation plan prior to running tests. Database unit test projects store the location of the referenced .dbproj and .dgen files as relative paths in the app.config file.

When building a database project using Team Build, the output and source files are stored in a different directory structure on the build machine. The test files are located in a TestResults folder while the source files are located in a Sources folder. When the unit tests are run from the TestResults folder, the relative path to the referenced .dbproj and/or .dgen files in the <assemblyname>.config file is no longer correct. This causes the tests to fail with one of the following messages:

Database deployment failed. Path ‘<path>\Database1.dbproj' is not a valid path to a database project file.

Data Generation failed. Path '<path>\Data Generation Plans\DataGenerationPlan1.dgen' is not a valid path to a data generation plan file.

Additionally, the app.config file also stores connection string information that points to the SQL Server instance to be used for running tests. If the connection strings are not valid when the tests are run from the build machine during a Team Build, the unit tests will fail with the following message:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

(Note that you may want the connection string to change depending on if they are running locally or through Team Build. For example, you may want tests to use your local SQL Server instance during development but use a remote shared instance when running via Team Build. The solution to this issue can also be used to achieve this result.)

To fix this issue, users need to manually create an app.TeamBuild.config file with the correct path locations and connection strings to be used when builds are created via Team Build. This file will then be renamed to <AssemblyName>.config through a post-build target, overwriting the .config file that contains the incorrect values.

  1. Create a file named app.TeamBuild.config by copying the existing app.config in your unit test project. Add it to your unit test project in version control.
  2. In the app.TeamBuild.config file, change the relative path to the .dbproj and .dgen files by adding a folder level for the Sources folder and a subfolder with the same name as the solution. For example,

    Before:
    "..\..\..\Database1\Data Generation Plans\DataGenerationPlan1.dgen"

    After:
    "..\..\..\Sources\Database1\Database1\Data Generation Plans\DataGenerationPlan1.dgen"

    Before:
    "..\..\..\Database1\Database1.dbproj"

    After:
    "..\..\..\Sources\Database1\Database1\Database1.dbproj"

    Additionally, you can modify the connection strings in the app.TeamBuild.config to the strings that should be used from the Team Build machine. Check the changes back into version control.
  3. Check out the unit test project file and modify the end of the file to include these lines right before the </project> tag. Check the changes back into version control.
    (Note: You may need to replace v9.0 with v8.0 depending on the version of DBPro you are using.)

    <Import Condition="'$(TeamBuildConstants)' != ''" Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\TeamData\Microsoft.VisualStudio.TeamSystem.Data.TeamBuildTasks.targets"/>

    <Target Name="AfterBuild" DependsOnTargets="$(AfterBuildTeamBuildTargets)">
    </Target>

  4. On the Team Build machine, create a file with the code below and name it Microsoft.VisualStudio.TeamSystem.Data.TeamBuildTasks.targets. Save the file in folder %Program Files%\MSBuild\Microsoft\Visual Studio\v9.0\TeamData
    (Note: You may need to replace v9.0 with v8.0 depending on the version of DBPro you are using.)

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

    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <UsingTask TaskName="DataGeneratorTask" AssemblyName="Microsoft.VisualStudio.TeamSystem.Data.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

    <PropertyGroup>
      <AfterBuildTeamBuildTargets>RenameTeamBuildConfig</AfterBuildTeamBuildTargets>
    </PropertyGroup>

    <ItemGroup>
      <__TeamBuildConfig Include="$(OutDir)$(TargetFileName).config"/>
    </ItemGroup>

    <Target Name="RenameTeamBuildConfig">
      <CreateItem Include="app.teambuild.config">
        <Output ItemName="TeamBuildAppConfig" TaskParameter="Include" />
      </CreateItem>
      <Copy SourceFiles="@(TeamBuildAppConfig)" DestinationFiles="@(__TeamBuildConfig)" />
    </Target>

    <Target Name="DataGen">
      <DataGeneratorTask
       ConnectionString="$(ConnectionString)"
       SourceFile="$(SourceFile)"
       PurgeTablesBeforePopulate="$(PurgeTablesBeforePopulate)"
       Verbose="$(Verbose)" />
    </Target>

    </Project>

August 18, 2007
» Team System Web Access for TFS 2005 FAQ

I wanted to highlight the TSWA for TFS 2005 FAQ since it contains good information, including how to switch between Windows authentication and forms authentication, turning off forms authentication, and how to construct the URL to a work item using the work item's ID.

Visual Studio Team System Web Access FAQ

  • Q: Can I install Team System Web Access on an existing Web site?
  • Q: Which Web site port should I use for Team System Web Access Web site?
  • Q: How can I activate the log file?
  • Q: What’s the difference between Forms-based authentication and Integrated Windows authentication modes?
  • Q: How can I switch between Forms-based authentication and Integrated Windows authentication modes?
    • To enable Forms based authentication:
    • To enable Integrated Windows authentication:
  • Q: How can I enable sending work items as e-mail messages?
  • Q: What’s the URL to use if I want to send the link of a specific work item?
  • Q: How can I disable signing out and logging in as a different user (i.e., disable forms authentication)?
  • Q: How can I customize the bug form?
  • Q: Can I use Team System Web Access with Team Foundation Server in workgroup (non-domain) mode?
  • Q: Can I use Team System Web Access with single server / dual server Team Foundation Server configurations?

August 15, 2007
» TFS 2008: A basic guide to Team Build 2008

Patrick Carnahan, a developer on Team Build, put together the following guide to the basic, as well as a few advanced, features of Team Build in TFS 2008.  It's a great way to get started with continuous integration and other features in TFS 2008.

Team Build – Continuous Integration

One of the new and most compelling features of Team Foundation Build is the out-of-the-box support for continuous integration and scheduling. A few in-house approaches have been built around the TFS Soap Event mechanism, most likely set to listen for check-in events and evaluating whether or not a build should be performed. The disadvantages to this approach are the speed and accuracy at which build decisions may be made.

For all of the following steps, it is assumed that the ‘Edit Build Definition’ dialog is currently active. To activate this dialog, expand the ‘Builds’ node of the team project to which your V1 build type belongs (or to which you want to add a new V2 build definition) and click on ‘Edit Build Definition’ as shown below.

Setting up the workspace

Setting up a workspace is pretty important to the continuous integration build, since this is how the server determines when to automatically start builds on your behalf. Although the default workspace mapping is $/<Team Project Name> -> $(SourceDir), something more specific should be used in practice. For instance, in the Orcas PU branch you should use (at a minimum) the mapping $/Orcas/PU/TSADT -> $(SourceDir).

What is this $(SourceDir) variable? Well, in V1 the build directory was specified per build type, meaning that the build type was built on the same directory no matter what machine the build was performed on. In V2 we have separated out the idea of a build machine into a first-class citizen called a Build Agent; this is where the build directory is stored. The variable $(SourceDir) is actually a well-understood environment variable by Team Build, and is expanded to: <BuildAgent.BuildDirectory>\Sources (more on the Build Directory and environment variables later). Typically you will want to make use of $(SourceDir) and keep everything relative to it, but there is no restriction that forces this upon you.

Just so we’re on the same page with the workspace dialog, a picture has been included below. Those of you familiar with version control workspaces should feel right at home!

Already have a workspace ready to go? Simply select the ‘Copy Existing Workspace’ button to search for existing workspaces to use as a template. The local paths will be made relative to $(SourceDir) automatically!

Defining a Trigger

The trigger defines how the server should automatically start builds for a given build definition.

http://blogs.msdn.com/photos/buckh/images/1623211/original.aspx

The first option should be self-explanatory, and keeps the build system behaving just like V1 (no automatic builds). The other options are as follows.

  • The 'Build each check-in' option queues a new build for each changeset that includes one or more items which are mapped in a build definition's workspace.
  • 'Accumulate check-ins', otherwise known as 'Rolling Build', will keep track of any checkins which need to be built but will not start another build inside of the defined quiet period. This option is a good way to control the number of builds if continuous integration is desired but you want a maximum number of builds per day (e.g. 12 builds per day, which would require a quiet period of 120 minutes) or your builds take much longer than the typical time between checkins.
  • Standard scheduled builds will only occur if checkins were made since the previous build. Don't worry about this rule affecting the first build, however, because the system will ensure that the first build is started right on time.
  • Scheduled builds can optionally be scheduled even if nothing changes. This is useful when builds are dependent on more than what is in version control.

Drop Management

One of the side effects of a continuous integration system is that a greater number of builds will be created. In order to manage the builds and drops created through CI we have introduced a feature in Team Build called drop management.

Drop management is enabled through a concept we call Retention Policy in Team Build, which allows you to define how many builds to retain for a particular build outcome. For instance, you may only want to keep the last 5 successful builds and only one of any other kind. Through retention policy you can define this by setting the appropriate values in the dialog shown above and the server will manage the automatic deletion of builds for you.

What if you don’t want a build to be susceptible to automatic deletion? We have an option available on individual builds if you would like to retain a build indefinitely (it just so turns out that this is what the menu option is called). To do this go to the ‘Build Explorer’ in Visual Studio 2008 (available by double clicking a node under the Builds node in the Team Explorer window), right click on the build, then select ‘Retain Indefinitely’. Once this option has been toggled on you will see a padlock icon next to the build.

If you decide that the build is no longer useful, simply toggle the option off for the build and let drop management take care of the build automatically.

Advanced Topics

1. Automated UI Tests

Automated UI tests cannot be run in the build agent running as a windows service since it is not interactive, meaning that it cannot interact with the desktop. So, we have provided the ability to run an interactive instance of the service out-of-the-box!

The first thing you will need to do is create a new build agent on the server. To do this you should right click on the ‘Builds’ node for your team project, then click ‘Manage Build Agents’. Once this dialog comes up, click the ‘Add’ button which will bring you to the dialog below.

The display name can be anything descriptive you want. For instance, if the machine name is ‘BuildMachine02’ you may choose to name the build agent ‘BuildMachine02 (Interactive)’ so you can easily differentiate between the interactive and non-interactive agents. The computer name should be the computer name of the machine on which the build service resides, and the port should be changed to 9192 since it is the default interactive port. When changing the port you may see a dialog with the message below, which may be safely disregarded in this case since you’ll be using the default interactive port.

TF226000: After you change the port that is used by Team Foundation Build, you must also update the build service on the build computer to use the new port. For more information, see http://go.microsoft.com/fwlink/?LinkId=83362 .

In order to run the build service in interactive mode just start a command-prompt on the build computer in the directory %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies (if you do not want to run the build agent service as yourself then you need to be sure to spawn the command-prompt as the correct user using the ‘runas’ command). Now that you’re in the directory as the appropriate user all you need to do is type ‘TFSBuildService.exe’, which will output something similar to the following:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies>TFSBuildService.exe

Press the Escape key (Esc) to exit...

Once you see that prompt your interactive agent is ready to go. You’ll need to leave that command running. Be sure that any time you need to run automated UI tests that you target the correct agent!

2. Build Directory Customization

In TFS 2005, you were able to specify the root build directory which should be used in the build type definition file TfsBuild.proj. During the build, the root build directory would automatically get expanded to:

<Root Build Directory>\<Team Project Name>\<Build Type Name>

This was not configurable and was done this way to ensure uniqueness across build types being built on the same machine. The sources, binaries, and build type were then brought into sub folders named ‘Sources’, ‘Binaries’, and ‘BuildType’, respectively. Since the names could get quite long, there were quite a few issues with path name length errors which were unavoidable.

In TFS 2008 we have made it easier to customize the build directory on the agent through the use of 2 well-known environment variables.

$(BuildDefinitionPath), which expands to <TeamProjectName>\<DefinitionName>

$(BuildDefinitionId), which is the unique identifier by which the definition may be referenced (an Int32)

The build directory is no longer guaranteed to be unique by the system automatically unless one of these two variables is used. This approach has some great advantages, especially since $(BuildDefinitionId) is merely an Int32 and will definitely reduce the length of paths at the build location!

There is another method by which this path may be reduced even more if the source control enlistment requires it. If you take a look at the file %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\TfsBuildService.exe.config on the build computer, you will see some settings which may be of interest to you.

<add key="SourcesSubdirectory" value="Sources" />

<add key="BinariesSubdirectory" value="Binaries" />

<add key="TestResultsSubdirectory" value="TestResults" />

These control the name of the sub-directories which will house the Sources, Binaries, and TestResults. If you need an even shorter path, you could name the sources sub directory ‘s’!

NOTE: Be sure to restart the team build service ( the Windows service or the interactive service, as needed) after making changes to this file in order for the changes to take effect!

3. Port Configuration

For Orcas we have changed the communication method for the build agent (the build agent is the service installed and running on the build computer). In TFS 2005 the Team Build Server communicated with the build machines via .NET Remoting. In TFS 2008 we changed this to use SOAP+XML over HTTP, just like the other Team Foundation services. In order to do this, we have switched to using Windows Communication Foundation self-hosting functionality to expose the service end-point without requiring Internet Information Services (IIS) on the build computer. There is a new series of steps which must be followed in order to change the port for an existing TFS 2008 build agent.

  1. Disable the build agent on the server using the 'Manage Build Agents' option in Visual Studio 2008 described above. This will keep the server from starting new builds on the machine, but will let existing builds finish. This way you do not accidentally stop an in-progress build from finishing.
  2. Once there are no builds running, issue a 'Stop' command to the build Windows service, either using the Windows Services control panel or from the command line using the "net stop vstfbuild" command.
  3. Navigate a command prompt to the directory %PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.
  4. Open the file TFSBuildService.exe.config, and look for a child element in the <appSettings> section with the key="port" (case sensitive!). Change the value of that key to the desired port and remember the value for the next step.
  5. In the same directory there will be an executable named wcfhttpconfig.exe. This will ensure that the appropriate URL ACLs are in place to allow the service account to listen for incoming HTTP requests. The command you should issue is: 'wcfhttpconfig reserve <domain>\<user name> <port number>'. You must run this command as a local administrator.
  6. Now issue a 'Start' command to the window service. 
  7. Change the status of the build agent back to 'Enabled' using the 'Build Agent Properties' dialog and click ok.

You can find the official docs on MSDN at How to: Configure an Interactive Port for Team Foundation Build.

NOTE: Changing the port of the Interactive Service is exactly the same as the instructions above with one exception: the appSettings key you will need to modify is ‘InteractivePort’.

[UPDATED 9/07/07]  I've added links to the official docs on changing the port.