Bill Wang’s Blog

December 18, 2008

Switch to use my old blog

Filed under: Uncategorized — Bill @ 11:18 am

Because blogs on are blocked in China. I decided to use my old blog: Sorry for the inconvenience.


December 2, 2008

Troubleshooting TF55030 error while running RenameDT

Filed under: Uncategorized — Tags: — Bill @ 8:04 am

While running RenameDT command, many customers getting error message TF55030: Rename Data Tier failed. Please verify that the supplied Data Tier name is a valid Team Foundation Data Tier name, that the Data Tier can be accessed on the network and that you have administrative rights. This error message is not precise enough to reveal what’s going wrong. So I’m writing this blog to help users diagnostic TF55030 error.

RenameDT comes from TfsAdminUtil family. Setting environment variable TfsDetailedErrors to 1 will make TfsAdminUtil to generate more detailed information.

We run RenameDT when the name of DT is changed or after TFS is moved. In TFS 2008, RenameDT command will perform the following tasks:

  1. Get the old DT name from TFS_Install_Folder\Web Services\Services\Web.config. The connection string to the DT is stored in this configuration file.
  2. Compute the connection string to the new DT by replacing the old DT name in the connection string with the new DT name passed to RenameDT command. This is why we need to set the connection string in Web.config to point to the old TD. The old DT will not be affected.
  3. Update the connection string for TfsReportDS and TfsOlapReportDS in the reporting service used by TFS to use the new DT name.
  4. Update the DT name stored in TFS databases.
  5. Update the connection string stored in the Web.config.
  6. Restart the IIS.

Now we know what’s going on when running RenameDT. When meeting TF55030 error again, please checking following things:

You have enough permission to run RenameDT command.

You must be a member of the Team Foundation Administrators group and a member of the sysadmin group on SQL Server. Please read “Required Permissions” section of the MSDN document RenameDT Command for more information.

You can connect to the new DT in AT machine.

You can open SQL Server Management Studio or create a .udl file on AT machine, verify you can connect to the new DT.

Reporting service works correctly.

You can use ConfigureConnections command to view and modify the reporting service URL used by TFS. After TFS is moved, you need to point the TFS to the new reporting service instance before run RenameDT.


One part of moving reporting service is restoring the old reporting service encryption key. Encryption key is used to encrypt sensitive data stored in reporting service database. The connection strings used by data source TfsReportDS and TfsOlapReportDS are encrypted too. Thus the old encryption key must be restored so that RenameDT can read and update the connecting string used by TfsReportDS and TfsOlapReportDS.


The easiest way to check if encryption is restored correctly is opening the reporting service in web browser. The default URL is http://TfsServer/Reports. If you get error message like “The report server installation is not initialized. (rsReportServerNotActivated) (rsRPCError)“, then it’s probably caused by that the correct encryption key used by the old reporting service instance is not restored.


If the old encryption key is lost and your reporting service is only used by TFS, you can simply delete the encryption key and reconfigure the connection strings for data source TfsReportDS and TfsOlapReportDS. If you can browse reports then the encryption key should be restored correctly.

After the above checks, please run RenameDT again. If your scenario is not included in the above checklists, please let me know.

November 23, 2008

TF50309 error message for TFS service account TfsService

Filed under: Uncategorized — Tags: — Bill @ 7:45 am

Today I moved my TFS server from a workgroup to domain environment. When I run ActivateAT to start TFS, everything works fine. When I connect to the TFS from Team Explorer, I get several error logs in Windows event log in the machine for AT saying:

TF50309: The following account does not have sufficient permissions to complete the operation: Domain\tfsservice. Check the permissions for the account and grant the appropriate permissions to perform this operation. (type SecurityException)

Then I run TfsAdminUtil SID and found the TFS service account is not listed. This problem is solved by adding the service account TfsService to Service Accounts group by running TfsSecurity command:
      TfsSecurity g+ “Service Accounts” Domain\TfsService

November 5, 2008

BuildStep task statuses

Filed under: Uncategorized — Tags: — Bill @ 11:33 am

The BuildStep task enables us to add custom build steps to a team build report. This task exposes 3 possible statuses that we can set to:

  • Succeeded
  • Failed
  • Stopped

Plus one more status which is not exposed:

  • InPrograss

The default status of a build steps is InPrograss. If we don’t set the status, the build step status in the result build report will be:

  • Failed if the team build is aborted. When we stop a team build, all build steps with InProgress status will be marked to Failed.
  • InPrograss if the build completes normally.

As we already know, we can open the build report before the build is finished. When the build engine meets a BuildStep task declaration, it will add an item to the “Build steps” section in the team build report. We usually declare a BuildStep task with the default status InPrograss to show the build engine is performing a set of tasks, then we set the status of the BuildStep when our tasks are finished.

The following example demonstrate how to organize build step declaration and evaluation. The example overrides AfterDropBuild target to run some tasks there. If no error occurs, the status for the build step will be set to Succeeded. If there’s an error encountered in AfterDropBuild target, HandleMyBuildStepFailed target will be executed.

<Target Name=“AfterDropBuild”>
<BuildStep TeamFoundationServerUrl=“$(TeamFoundationServerUrl)”
BuildUri=“$(BuildUri)” Name=“MyBuildStep”
Message=“My build step is executing.”>
<Output TaskParameter=“Id” PropertyName=“MyBuildStepId” />
<!–Add tasks here–>
<BuildStep TeamFoundationServerUrl=“$(TeamFoundationServerUrl)”
BuildUri=“$(BuildUri)” Id=“$(MyBuildStepId)” Status=“Succeeded” />
<OnError ExecuteTargets=“HandleMyBuildStepFailed”/>
<Target Name=“HandleMyBuildStepFailed”>
<BuildStep TeamFoundationServerUrl=“$(TeamFoundationServerUrl)”
BuildUri=“$(BuildUri)” Id=“$(MyBuildStepId)” Status=“Failed” />

What I have missed? Oh, the Stopped status. If the status of BuildStep task is set to Stopped, the whole team build will be stopped. Thus we rarely use this status.

November 1, 2008

Troubleshooting TFS alerts

Filed under: Uncategorized — Tags: — Bill @ 12:24 pm

The Event Service in TFS supports many kinds of events. Users can subscribe them to be get alerts when a particular event is trigged. TFS supports alert by sending a email or calling a web service. When you can’t receive email alerts, please check the following things:

SMTP server is working
TFS relies on an SMTP server to send out email. So, the first thing is to make sure the SMTP server is working.

If you can login the SMTP server, please read How to test outbound mail flow with a file in the Pickup folder. If the SMTP server is OK, please check the server that hosts TFS is authorized to access SMTP service. And this is described in How to Assign an IP Address section in KB 308161.

If you can’t login the SMTP server, you can write a simple code to send a mail. See Pete Sheill’s blog for more information.

TFS is configured to use a SMTP server
See MSDN document How to: Configure SMTP Server and E-mail Notification Settings in the Services Web.Config File

The alert is not blocked by recipient’s mailbox
If you configured mail policy to block mails from unknown user, you will need to add the “From Address” of alert into the trusted list.

After you checked all of above items, please subscribe to an event without any filter. You should be able to receive alerts when the event is triggered.

October 31, 2008

Test WCF web service – Hosted in ASP.NET Development Server

Filed under: Uncategorized — Tags: , — Bill @ 11:53 am

A refined post of this topic is available in

Today, a customer asked me how to test WCF web service. I searched internet and found no document addressing this. So I think it will be necessary to write a blog describing test different kinds of WCF web service.

As we know, WCF can be hosted in IIS with some .svc files. During the development, we normally use file system based web site project instead of IIS based. If TFS is used, we often use ASP.NET Web Application project template to develop web application.

The MSDN document Testing Web Services describes how to test .asmx web service locally. It uses WebServiceHelper.TryUrlRedition to redirect the url of web service proxy dynamically. For WCF web service, we use svcutil command-line tool to generate web service client and app.config file. And it needs us to redirect web service url in a different way.

The follow is the steps to create a .svc web service and create a test project. It’s similar to creating tests for .asmx web service.

  1. Open Visual Studio and create a ASP.NET Web application.
  2. Add a WCF Service item to the project.
  3. Create the unit test method for a web service method in the standard way of generating unit test.
  4. Remove the generate attribute for the test method. We can just use TestMethod attribute and AspNetDevelopmentServer attribute.
  5. Run command svcutil to generate client. Svcutil is in %ProgramFiles%\Microsoft SDKs\Windows\v6.0A\bin.
  6. Add the generated web service client and app.config file to the test project.
  7. In the test project, create a new class WcfWebServiceHelper to redirect Url:
    public static bool TryUrlRedirection(object client, TestContext context, string identifier)
        bool result = true;
            PropertyInfo property = client.GetType().GetProperty(“Endpoint”);
            string webServer = context.Properties[
                string.Format(“AspNetDevelopmentServer.{0}”, identifier)].ToString();
            Uri webServerUri = new Uri(webServer);
            ServiceEndpoint endpoint = (ServiceEndpoint)property.GetValue(client, null);
            string serviceAddress = endpoint.Address.Uri.OriginalString;
            serviceAddress = serviceAddress.Replace(
                endpoint.Address.Uri.Authority, webServerUri.Authority);
            endpoint.Address = new EndpointAddress(serviceAddress);
        catch (Exception)
            result = false;
        return result;
  8. In the unit test method, insert a call to TryUrlRedirection before calling any web method. And the following is a sample of test method:
    public void FooTest()
        MyWcfServiceClient target = new MyWcfServiceClient();
        target, TestContext, “WebApplication1”));
        string expected = “Hello World”;
        string actual;
        actual = target.HelloWorld();
        Assert.AreEqual( expected, actual);

How to configure tests based on build configuration

Filed under: Uncategorized — Tags: — Bill @ 11:52 am

Team build provides ability to build both Release and Debug bits in the same build. If there are unit tests, it will run tests for both Release bits and Debug bits. Sometimes, we might want to run tests or use run configure files based on the build configuration. For example, you might want to get code coverage for the Debug build, while you don’t want to instrument the Release build.

The target CoreTestConfiguration in the team build runs for each build configuration. So, we can override target BeforeTestConfiguration to set properties used by TestToolsTask based on build configuration.

The following code demonstrate how to parse in test run configure file based on the build configureation:

<Target Name=”BeforeTestConfiguration”>
<PropertyGroup Condition=”‘$(Configuration)’==’Debug'”>
<PropertyGroup Condition=”‘$(Configuration)’==’Release'”>

Custom build script succeeded while the Team Build failed

Filed under: Uncategorized — Tags: — Bill @ 11:52 am
Aaron Hallberg described how to kick off a custom build script in a team build. Please reference A Minimal TFSBuild.Proj File for more information. The interesting thing is that you may notice the team build fails even if the custom script executed successfully.

In a team build, the overall build status might be Succeeded, Partially Succeeded and Failed. The overall status will be


  • Succeeded if no error occurs.
  • Partially Succeeded if CompilationStatus is succeeded but error occurs in other part of the build
  • Failed if CompilationStatus is failed.

CompilationStatus and TestStatus are 2 properties created during a team build. When the build service is about to determine the overall build status, it checks CompilationStatus, TestStatus and other occurred errors. The default value for CompilationStatus and TestStatus is Unknown. Thus when you kick off custom build script by overwriting EndToEndIteration target, if CompilationStatus and TestStatus are not set, the overall status will be Failed even if no errors are listed in the build log. And SetBuildProperties task can be used to set them:

<SetBuildProperties TeamFoundationServerUrl=”$(TeamFoundationServerUrl)”
TestStatus=”Succeeded” />
After both CompilationStatus and TestStatus are set to Succeeded, the only factor that determines the overall build status will be an internal log property that tracks whether any error occurs. If there’s no error in the custom build script, then the overall build status will be Succeeded.


Microsoft.VisualStudio.TeamFoundation.PowerPools.TfptPackage Load Failure

Filed under: Uncategorized — Tags: — Bill @ 11:51 am

A few days ago, one customer installed TFS Power Tool-July 2008 Release and got an red X on the Alerts node in Team Explorer. In this case, it turns out to be caused by a package load failure. The detail error message is:

Package ‘Microsoft.VisualStudio.TeamFoundation.PowerPools.TfptPackage,
Microsoft.VisualStudio.TeamFoundation.PowerTools, Version=,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ has failed to load
properly (GUID = {2C5A58FF-51D1-46CC-B46C-CD458632B321}).
Please contact package vendor for assistance. Application restart is
recommended, due to possible environment corruption. Would you
like to disable loading this package in the future? You may use ‘devenv
/resetskippkgs’ to re-enable package loading.

My initial response is to download the power tool and reinstall it. But the same problem still occurs. After extensive research, I still didn’t get much progress. Later when I was looking at another issue, I opened the document for devenv /setup, and it mentioned that this switch has something to do with VSPackages! I then suggested my customer to run ‘devenv /setup’ first, then reinstall TFS Power Tool. And it worked! Everything goes well and the customer is very happy with the alert features.

Create a free website or blog at