My session on TFS at the ‘Building Applications for the Future’

Thanks to everyone who attended my session on ‘TFS for Developers’ at the Grey Matter’s ‘Building Applications for the Future’ event today. As you will have noticed my session was basically slide free, so not much to share there.

As I said at the end of my session to find out more have a look at

Also a couple of people asked by about TFS and Eclipse, which I only mentioned briefly at the end. For more on Team Explorer Everywhere look at the video I did last year on that very subject

Webinar on PreEmptive Analytics tools on the 28th of May

A key requirement for any DevOps strategy is the reporting on how your solution is behaving in the wild. PreEmptive Analytics™ for Team Foundation Server (TFS) can provide a great insight in this area, and there is a good chance you are already licensed for it as part of MSDN.

So why not have a look on the UK MSDN site for more details the free Microsoft hosted event.

MSDN Webinar Improve Software Quality, User Experience and Developer Productivity with Real Time Analytics
Tuesday, May 28 2013: 4:00 – 5:00 pm (UK Time)

Also why not sign up for Black Marble’s webinar event in June on DevOps process and tools in the Microsoft space.

Upgrading DotNetNuke from V5 to V7

I recently needed to upgrade a DNN V5 site  to V7 (yes I know I had neglected it, but I was forced to consider a change due to an ISP change). Now this is a documented process, but I had a few problems. There are some subtleties the release notes miss out. This is what I found I had to do to test the process on a replica web site …

Setup the Site

  • I restored a backup of the site SQL DB onto a SQL 2008R2 instance running on Windows 2008R2.
  • On the same box I created a new IIS 7 web site and copied in a backup of the site structure and setup the virtual application required for my DNN configuration.
  • I made sure the AppPool associated with the site and application was set to .NET 2.0 in classic mode.

image

  • I fix the connection strings to the restored DB in the web.config (remember there are two DB entries, one in ConnectionString and one in AppSettings).
  • At this point I thought it was a good idea to test the DNN 5 site

The Upgrade

  • I copied over the contents of the DDN V7 upgrade package
  • I changed the AppPool from .NET 2.0 Classic mode to .NET 4.0 in Integrated pipeline mode
  • I tried to load the website – at this point I got an ASP.NET 500 Internal error

An aside – If I used a Windows 8 PC (using IIS 7.5) all I got was the 500 internal error message, no more details. I am sure you can reconfigure IIS 7.5 to give more detailed messages. However, i chose to Windows 2008R2 and IIS7 which gave me a nice set of 500.19 web.config errors

  • The issue was I needed to edit the web.config to remove the duplicate entries it found, they are all in the form. Just remove the offending line, save the file and refresh the site.

image

<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />

  • I then got the unhelpful DotNetNuke Error. Turns out this down to the wrong version of Telerik DLLs. They are not shipped in the DDN 7 upgrade package,  I just copied the bin folder from the DNN 7 Install package which contains the right versions

image

  • The DNN upgrade wizard should now load. I entered my login details and let it run, it took about a minute.

image

The site might still not load (showing the error below), this is because the DB stores the sites based on the full domain name, so trying to load using something like http://localhost/dnn may not work (unless you configured it as the address). I had to edit the hosts file on my PC so my full domain name e.g http://www.mydomain.com/dns resolved to 127.0.0.1. The alternative is to (if you can connect) on the hosts > site management > edit the site > site aliases and enable ‘auto add site alias’. if this is done you can connect with any address

image

503 Problems

Now that should be the whole story, but I still had problems. I kept seeing 503 errors

image

On checking I found the AppPool kept stopping. The event log showing

Application: w3wp.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an internal error in the .NET Runtime at IP 000007FEF8E21550 (000007FEF8E20000) with exit code 80131506.

and

Application pool ‘DDN’ is being automatically disabled due to a series of failures in the process(es) serving that application pool.

I tried a clean install of DNN 7 to it own DB (on the same server) using the same AppPool. This all worked fine. So I had to assume the problem lay with either

  1. My web.config
  2. My upgraded DB
  3. Some assembly in my installation

Reading around hinted that AppPools stopping could be due to having mix .NET 2/3.5 and 4.0 assemblies. So I was favouring option 1 or 3

In the end I chose to use the web.config from the DNN V7 installation package. I just copied this over the upgraded one and edited the connection strings. I also had to replace the machine key entry.

<machineKey validationKey="<and string>" decryptionKey="<and string>" decryption="3DES" validation="SHA1" />

This has to swapped as this is used to decrypt data such as passwords from the DB, if you don’t do this you can’t login in.

Once this new web.config was changed the site loaded without any errors. I never tracked down the actual line in the web.config that caused the problem.

DNN Log Errors

I repeated this upgrade process a few times before I got it right. On one test I saw errors in my ./DNN/Portals/_Default/Logs in the form

2013-05-13 21:46:50,505 [TyphoonTFS][Thread:14][ERROR] DotNetNuke.Services.Exceptions.Exceptions – System.Data.SqlClient.SqlException (0×80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_ScheduleHistory_Schedule". The conflict occurred in database "dnn", table "dbo.Schedule", column ‘ScheduleID’.

I fixed this by deleting the contents of the a dbo.ScheduleHistory table. However, I think this is a red herring as when I got the rest of the process OK this error was not shown.

Content Update

Finally I could upgrade the skin being used by the site to make it look like a DNN 7 based site.

  • Most importantly for me was to get the new admin look by changed the way the DNN admin menus are shown. This is done by changing the Host Settings > Other Settings > Control Panel to CONTROLBAR. This gets you the new menu banner model at the top of the page (this took me ages to find!)

image

  • I updated my extension modules (Host > extensions). This page shows which modules have updates. Click on the green update link to download the package. Then the use the ‘Install Extension Wizard’ button at the top of the page to install them.

image

  • Finally I started to changed from a V5 skin to one of the DNN V7 ones, I was using a customised version of the old default of MinimalExtropy, I swapped to the new  one based on the new default Gravity

So this is still a work in progress as with any CMS solution. Now I need to repeat the process by moving my installation from the old ISP to the new one.

Why do all my TFS labels appear to be associated with the same changeset?

If you look at the labels tab in the source control history in Visual Studio 2012 you could be confused by the changeset numbers. How can all the labels added by my different builds, done over many days, be associated with the same changeset?

image

If you look at the same view in VS 2010 the problem is not so obvious, but that is basically due to the column not being shown.

image

The answer is that the value shown in the first screen shot is for the root element associated with the label. If you drill into the label you can see all the labelled folders and files with their changeset values when the label was created

image

So it is just that the initial screen is confusing drilling in makes it all clearer.

Interested in some tutor delivered training on TFS 2012 in the UK?

Interested in some tutor delivered training on TFS 2012? Well Anthony Borton, the TFS trainer and ALM MVP, is over in the UK running his excellent set of the TFS/VS 2012 focused courses.

  • TFS 2012 Configuration and Administration
    10th – 12th June 2013 | Course Outline
  • Software testing with Visual Studio 2012
    13th- 14th June 2013 | Course Outline
  • TFS 2012 Developer Fundamentals
    17th – 18th June 2013 | Course Outline

Interestingly these courses can be taken in the room with the trainer or via Quicklearn’s Remote Classroom Instruction (RCI), so you can take the course in real time with the other students from the comfort of your own home/desk, but with all the benefits of a tutor classroom environment

If you are interested in these courses and need UK billing get in touch with lisa@blackmarble.co.uk for more details

How healthy is my TFS server?

If you want to know the health of the TFS server there are a number of options from a full System Center MOM pack downwards. A good starting point are the performance reports and administrative report pack produced by Grant Holiday. Though the performance pack is  designed for TFS 2008 they work on 2010 and 2012, but you do need to do a bit of editing.

  1. As the installation notes state, create a new shared data source called “TfsActivityReportDS”
    1. Set the connection string to: Data Source=[your SQL server];Initial Catalog=Tfs_[your TPC name]    -  this is the big change as it this used to point to the tfs_ActivityLogging DB, this (as of TFS 2010) is now all rolled into you Team project Collection DB, so you need to alter the connection string to match your TPC. Also note if you use multiple TPCs you will need multiple data sources and reports.
    2. Credentials: domain\user that has access to the Tfs_[TPC Name] database
    3. Use as windows credentials when connecting to the data source
    4. Once uploaded each report needs to be edited via the web manage option to change it Data Source to match the newly created source

      image
    5. You also need to edit each report in the pack via Report Builder as the SQL queries all contain the full path. For each dataset, (and each report can have a few) you need to edit the query to only contain the table name not the whole SQL path

      i.e. From TfsActivityLogging.dbo.tbl_Command to tbl_Command

      image

Once this is done most of the reports should working and giving a good insight into the performance of your server.

Some reports such as the Source Control Requests and Top user bypassing proxy take a bit more SQL query fiddling.

  • Server Status – Top Users Bypassing Proxies – you need to alter the Users part of the query to something like (note the hard coded table path, i am sure we could do better, but I don’t usually need this report as have few proxies, so not made much effort on it)

    Users(
            ID,
            UserName,
            FullyQualifiedAlias,
            eMail
        ) AS
        (

            SELECT [personSK]
                  ,[Name]
                  ,[Domain] + ‘\’ + [Alias] as FullyQualifiedAlias
                  ,[Email]
              FROM [Tfs_2012_Warehouse].[dbo].[DimPerson] with (nolock)
        )

  • Source Control Requests – runs from a straight web service endpoint, so you need to edit the Url it targets to something like

http://localhost:8080/versioncontrol/v3.0/administration.asmx

Unlike the performance reports the admin report packs is designed for TFS 2010/2012 so it works once you make sure the reports are connected to the correct shared data sources.

However, remember the new web based Admin Tools on TFS 2012 actually address many of these areas out the box.

Getting going with the TFS Java API

If you are using the TFS 2012 Java API it is important you read the release notes. It is not enough to just reference the com.microsoft.tfs.sdk-11.0.0.jar file in your classpath as you might expect. You also have to pass a Java system property that associates com.microsoft.tfs.jni.native.base-directory with the location of the native library files that provide platform specific implementation for method calls.  The command line for this is done in the form

java.exe -D"com.microsoft.tfs.jni.native.base-directory=C:\Users\Username\YourApplication\native"

If you don’t set this property you get an exception similar to

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.microsoft.tfs.jni.internal.platformmisc.NativePlatformMisc.nativeGetEnvironmentVariable(Ljava/lang/String;)Ljava/lang/String;

Now setting this property on the command line is all well and good, but how do you do this if you are working in Eclipse?

The answer is you set the argument via the Run > Run Configuration. Select your configuration and enter the VM argument as shown below.

image

Once this is set you can run and debug you application inside Eclipse