Using Deployment Metadata in TFS Release Management

TFS Release Management allows you to use deployment metadata as a value for configuration variables in release templates. It comes in very handy when you need to refer to the build drop location or build number. The following is the list of available Metadata that can be used with Configuration Variables.

Build Directory        $(PackageLocation)

Build Number        $(BuildNumber)

Build Definition    $(BuildDefinition)

TFS Collection        $(TfsUrlWithCollection)

Team Project        $(TeamProject)

 

Unfortunately, you cannot create custom deployment metadata just yet. Hopefully that will change one day. Another "catch" is that deployment metadata can only be used in components. Deployment metadata cannot be used in actions or tools because those are taking place outside of the build process.

TFS builds and HTTP Code 500 error

At one of our clients, TFS build server was choking for no good reason with the following error “Please contact your administrator. There was an error contacting the server. Technical information (for administrator): System.ServiceModel.ServiceActivationException.” Not very useful error message, isn’t it? TFS logs were a bit more informative and had the following error:

WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/4342953
Exception: System.ServiceModel.ServiceActivationException: The service '/tfs/queue/DefaultCollection/Services/v4.0/MessageQueueService2.svc' cannot be activated due to an exception during compilation.  The exception message is: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item. ---> System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item
   at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
   at System.Collections.Generic.SynchronizedCollection`1.Add(T item)
   at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
   at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
   at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   --- End of inner exception stack trace ---
   at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
   at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
Process Name: w3wp

Now, that’s a much better error message. It actually tells us that the problem is caused by multiple bindings in IIS on TFS website and it tells us how this error can be fixed. I love such errors. Anyway, to fix the problem we need to add the following line to web.config file on TFS server:

<serviceHostingEnvironment aspNetCompatibilityEnabled=”true" multipleSiteBindingsEnabled="true" />

Then restart TFS Build Service, and it’s all good again…

Fixing “TF400508: The current process settings are either missing or not valid…” error

We have recently upgraded our TFS 2010 server to TFS 11 RC. The upgrade process was smooth and painless. But (there is always a "but"), when I tried to access new TFS Web Access (which is awesome, by the way), I get "TF400508: The current process settings are either missing or not valid…" error. This error is only happening with old "upgraded" projects and we do not see this error if I create a new project in TFS 11. So, it looks like the problem lies within the older template. To resolve the issue, I had to use updateProject file from Microsoft to update an Agile, Scrum or CMMI team project from Team Foundation Server 2010 to Team Foundation Server 11.

To run the updateProject batch file:

  • Launch Visual Studio 12 command prompt
  • Run updateProject batch file as follows:

    updateProject CollectionURL ProjectName TemplateName

For detailed instruction see http://msdn.microsoft.com/en-us/library/ff432837(VS.110).aspx

TF249063: The following Web service is not available…

If you get the following error "TF249063: The following Web service is not available: http://SERVER:17012/_vti_bin/TeamFoundationIntegrationService.asmx. This Web service is used for the Team Foundation Server Extensions for SharePoint Products. The underlying error is: The remote server returned an error: (404) Not Found. Verify that the following URL points to a valid SharePoint Web application and that the application is available: http:// SERVER:17012. If the URL is correct and the Web application is operating normally, verify that a firewall is not blocking access to the Web application.", when you try to create new projects in TFS 2010 or simply when you browse to SharePoint Extensions tab in TFS Administration Console, then most likely its caused by the fact that Team Foundation Server Extensions for SharePoint Products (aka TFS 2010 Solutions in SharePoint 2010 or 2007) were not installed properly. To resolve this issue you need to add those solutions manually to the solutions store and then deploy them:

  • Open Command Prompt
  • Change your directory to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\\bin\ (for SharePoint 2010) and C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\\bin\ (for SharePoint 2007)
  • Add TFS 2010 solutions using stsadm.exe command as follows:
    stsadm -o addsolution -filename "C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Templates\Microsoft.TeamFoundation.SharePoint.wsp"
    stsadm -o addsolution -filename "C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Templates\ TswaWebPartCollection.wsp"
    stsadm -o addsolution -filename "C:\Program Files\Microsoft Team Foundation Server 2010\Tools\Templates\Microsoft.TeamFoundation.SharePoint.Dashboards.wsp"
  • Then deploy solutions using either SharePoint Central Administration site or stsadm.exe command as follows:
    stsadm -o deploysolution -name Microsoft.TeamFoundation.SharePoint.wsp -local –force
    stsadm -o deploysolution -name TswaWebPartCollection.wsp -local –force
    stsadm -o deploysolution -name Microsoft.TeamFoundation.SharePoint.Dashboards.wsp –url "YOUR WEB APP URL" –force
  • Go back to TFS Administration Console and Grant Access to your SharePoint farm
  • Under SharePoint Web Applications tab, add SharePoint web application to be used for TFS-related SharePoint sites
  • Under Team Project Collections, make sure that all your existing Project Collections are tied to your SharePoint instance.

That is all J

How to run tests cross domain with TFS 2010 from the “cloud”

If you need to run load tests (or any other tests) against your web application, the most efficient way to do it is to use "the cloud": Amazon Elastic Cloud or Windows Azure servers. Why? Two simple reasons:

  1. It's easy spin up as many servers as you need, which make it easier to scale up or down your test rig environment
  2. It's external to your environment, which is necessary to make your tests closer to a real life scenario

I won't bore you with details on how to set up your TFS environment and all. We're all adults; we know how to read install guides. I will only cover the things are not in any of those guides.

Server instance setup in Amazon EC2 (applicable to Windows Azure as well):

  • Pick large instance type or better. Small instance just is not powerful enough.
  • Use Windows Server 2008 operating system as host. Amazon EC2 does not support Windows Server 2008 R2 yet, and there is no good reason to still use Windows Server 2003 operating system.
  • Use an instance with SQL Server 2008 Express pre-installed to save time, unless you think your databases will be larger than 4Gb (very unlikely scenario in this cases)
  • When going through "Launch an instance" wizard, at the Security Groups screen, pick Default group and create new security group (you don't have to configure new security group now, this can be done later). Make sure both of those groups were selected as this will save you a lot of headache later.
  • Assign public IPs to your "cloud" servers and make sure that ISP that hosts your web application does not block or quarantine those IPs.

Host OS setup:

  • Disable Simple File Sharing. I am not sure why this feature is enabled on the servers.
  • Add your service account(s). To keep these notes simple, we will stick with one service account: tfsservice. Make sure all of your server instances have the same user accounts added (with the same passwords, of course)
  • If you're feeling lazy, grant your service account a local administrator's permissions
  • Make sure all of your "cloud" servers can see one another. If not, tweak your security groups in AWS Management Console.

TFS 2010 server tweaks:

  • Make sure that the user account with the same name and password as the service account on the cloud servers exists in the environment that hosts TFS 2010. Could be a local account on the TFS server or domain account.
  • Make sure that this service account is a member of Project Collection Administrators group, Project Collection Service Accounts group, and Project Collection Test Service Accounts group. Use tfssecurity.exe to add your user to those groups, if GUI does not let you.
  • In some cases, using SSL when connect to your TFS server does not work, so configure your TFS server to accept connections on HTTP port as well (for example, port 8080)

Test Controller configuration:

  • Make sure that the account you're using to run Test Controller service is a member of TeamTestAgentService local group
  • Always use ".\" instead of a domain name or machine name when provide credentials. For example, ".\tfsservice", instead of "SERVERNAME\tfsservice"
  • Do not register your test controller with any TFS project collection just yet
  • Enter SQL Server instance that will be hosting your Load Test database
  • Add virtual user licenses

Test Agent configuration:

  • Always use ".\" instead of a domain name or machine name when provide credentials. For example, ".\tfsservice", instead of "SERVERNAME\tfsservice"
  • Enter the machine name of your test controller. Use port default port 6901, unless you have configured your test controller to listen on a different port

I hope you found this info useful. If you have any questions or comments, shoot me an email at max [at] objectsharp [dot] com.

Visual Studio TFS Lab Management

One of my ongoing projects is to dive deeply into Visual Studio Team Foundation Server 2010.  TFS is pretty easy to get up and running, but as you get into some of the advanced features like Build Services and Lab Management, it gets kind of tricky.  Luckily there’s a fair bit of guidance from our favorite blue badged company.

On the Lab Management Team Blog there is a 4 part walkthrough on Getting Started with Lab Manager in TFS.  Since they are using the RC build of TFS, the walkthrough was pretty spot on to the RTM build.  Here is the walkthrough:

  1. http://blogs.msdn.com/b/lab_management/archive/2010/02/16/getting-started-with-lab-management-vs2010-rc-part-1.aspx
  2. http://blogs.msdn.com/b/lab_management/archive/2010/02/16/getting-started-with-lab-management-vs2010-rc-part-2.aspx
  3. http://blogs.msdn.com/b/lab_management/archive/2010/02/16/getting-started-with-lab-management-vs2010-rc-part-3.aspx
  4. http://blogs.msdn.com/b/lab_management/archive/2010/02/16/getting-started-with-lab-management-vs2010-rc-part-4.aspx

If you are looking for test code to try out deployments and testing check out part 3, as it contains a working project.

Overriding TFS 2010 installer memory constraints

Recently, I have been installing and configuring a lot of TFS 2010 environments. Really, a lot of TFS 2010 (production, test, proof-of-concept) servers. Occasionally, I anger TFS "gods", so TFS installer throws an error and complain that certain TFS components does not have enough memory complete the install. It turns out that SharePoint component of TFS environment requires minimum of 1Gb of memory to operate. So does, TFS Build server… Otherwise, you'll end with this error in the installer log: " TF255157: The amount of RAM available on this computer is not sufficient to complete this process. You must have the following amount of RAM available: 1024 MB…"

Usually adding more memory to the servers hosting TFS components solves the problem, but if you can't wait to start playing with awesome TFS 2010, here is how you can override TFS 2010 installer behaviour:

  • Create new environmental variable called TFS_IGNORE_VMEMORY and set its value to 1
  • Restart your Team Foundation Configuration Wizard (not the entire server), and this time TFS "gods" will like you again.

Please note, just because you bypassed memory constraints preconfigured in TFS 2010 installer, it does not mean that you should not add more memory to your servers. Your TFS 2010 servers will work so much better, when its server meet (or exceed) the memory requirements…

TFS 2010 Web Access “access denied” error

If you're getting "Access to the path 'C:\ProgramData\Microsoft\Team Foundation\Web Access\Cache' is denied" error when you try to access TFS 2010 Beta 2 via the Team Web Access, the problem most likely lies with missing NTFS permissions on the above-mentioned Cache folder. This problem often happens when you're running your TFS 2010 server on a domain controller, which is not ideal, but sometimes unavoidable, especially if you run all-in-one server setup.

There are two possible workarounds:

  1. First workaround is to assign Modify NTFS permissions on Cache folder on the TFS server to the service account used by SharePoint application pool in your TFS environment. Most likely, your SharePoint application pool (by default) runs under Network Service built-in account.
  2. Second workaround is changing SharePoint application pool to run under a domain account instead of Network Service account. I have read somewhere that this problem is caused by the fact that Network Service account cannot be added to a global group TFS_APPTIER_SERVICE_WPG, which is a domain group, not local to your TFS/DC server.

Note: If Cache folder does not exist, create one J

Integrating TFS 2010 with SharePoint 2010 beta 2

It is definitely possible to use SharePoint 2010 beta 2 with TFS 2010 beta 2. You don't even need to do a lot of work to get them working together. A few things to consider:

  • SharePoint 2010 beta 2 must be preinstalled (either on the same or separate machines) since TFS configuration wizard will not install SharePoint 2010 for you (only can only install WSS3)
  • You need to manually enable TFS to log diagnostics information to SharePoint 2010 logs, because Microsoft changed the trace mechanism used in SharePoint 2010. To do that open SharePoint 2010 Management Console and type in
    Set-SPDiagnosticConfig –AllowLegacyTraceProviders
  • Since we are dealing with beta products, some things in the project dashboards might look a bit funny in IE8
  • And last, but not least, if you decide to go with SharePoint 2010, do not forget to allocate a LOT of memory to SharePoint server (physical or virtual) because SharePoint will need it to function properly.

Team System Web Access 2008 SP1 CTP and Work Item Web Access 2008 CTP are now available

Team System Web Access 2008 SP1 CTP (Community Technology Preview) and Work Item Web Access 2008 CTP are now available for download. Even though it's only CTP version at the moment, don't let it discourage from using it, because it seems to be working very well. By the way, you still have to have Team Explorer 2008 installed to use TWSA and/or WIWA, which is not a big deal since it's free and most of us already have it installed anyway. For those who don't have Team Explorer 2008 installed, it can be downloaded for free from http://www.microsoft.com/Downloads/details.aspx?familyid=0ED12659-3D41-4420-BBB0-A46E51BFCA86&displaylang=en.

Team System Web Access 2008 SP1 has some really great features:

  • Single instance with multiple languages (9 languages are available: ENU, CHS, CHT, DEU, ESN, FRA, ITA, JPN, KOR)
  • 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

Team System Work Item Web Access 2008 CTP allows users to use some work item tracking feature without having TFS client access license (CAL.) A user without TFS CAL can use WIWA to:

  • Create new work items
  • Edit the work item you have created
  • See the list of work items you have created

However, user cannot:

  • See work items created by others
  • List, view, edit or run work item queries
  • Add, edit or remove work item links (except attachments and hyperlinks)
  • Access documents stored on the project portal
  • Access project reports
  • Access source control
  • Access team build

Specs for WIWA can be found at http://msdn2.microsoft.com/en-us/teamsystem/bb936702.aspx