TFS Best Practice Analyzer fails with “Cannot validate the URL provided”

The Team Foundation Server Power Tools contain a great tool called the Best Practice Analyzer. This tool helps you in automatically checking your Team Foundation Server installation and advising you on any problems that it may find.

So every time I install a new TFS environment, I use the BPA tool to validate any prerequisites and make sure the TFS environment is functioning correctly.

Running into some problems

After running BPA on a Windows Azure VM running Windows Server 2012 R2, the scan finished very quickly and showed the following:

BPA TFSServerURLValidated

To view more details, you can click on View a report of the Best Practices scan. This will generate a report that clearly shows something is wrong:

BPA Cannot validate the URL provided

To view a detailed log of what’s going wrong you can click on Other Reports. This will show you a Run-Time log that contains detailed information on the error BPA is encountering:

BPA Error Log

As you can see in the log file, there is an error stating that you are running the incorrect version of PowerShell. It’s looking for version 2.0, but Windows Server is running version 4.0.

Fixing the TFSServerURLValidated error

So how you can make sure that the BPA runs on a machine with a newer version of PowerShell?

You can add a configuration file that makes sure the supported runtime is set to .NET 4.0. Switching to .NET 4.0 also switches PowerShell to version 3 or later. Since BPA is a .NET application, adding a configuration file is easy. Just create a file <NameOfExe>.exe.config. When running the application, .NET will automatically load the config file with a corresponding name and apply any configuration settings in it to your application.

By default, BPA is installed in C:Program Files(x86)Microsoft Team Foundation Server 2013 Power ToolsBest Practices Analyzer. In here, you’ll find TfsBpa.exe which is the executable file that runs the BPA.

Now you need to create a corresponding config file called TfsBpa.exe.config. If User Account Control kicks in and doesn’t allow you to create a file, the easiest solution is to run Notepad as an administrator and save the file directly to the correct location.

Inside your new configuration file you put the following:

<configuration>
     <startup>
          <supportedRuntime version=”v4.0.30319″/>
      </startup>
</configuration>

And that’s it. Now BPA will run great operating systems like Windows 8 and Windows Server 2012.

Feedback? Questions? Please leave a comment!

Wouter de Kort works as a lead architect and consultant. He helps organizations stay on the cutting edge of software development. Wouter focuses on DevOps. He loves solving complex problems and helping other developers to grow. Wouter authored the book DevOps on the Microsoft stack and a couple of other books. Wouter is a Microsoft MVP and an ALM Ranger. You can find him on Twitter (@wouterdekort), on his blog at wouterdekort.com and at the various conferences where Wouter speaks.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.