a·gen·tic a·gil·i·ty

Unable to load task handler PowerShell for task VSBuild

TL;DR; When setting up TFS 2015’s vNext build system on Windows Server Technical Preview, you may encounter a “Unable to load task handler PowerShell for task VSBuild” error due to missing dependencies or blocked files. The issue is often caused by downloaded zip files being blocked by Windows, which prevents the build agent from working properly. To resolve this, ensure you unblock any downloaded zip files before extracting and configuring your build agent.

Published on
3 minute read
Image
https://nkdagility.com/resources/Rqhhvr6lAQK
Subscribe

If you are setting up to run Team Foundation Server’s vNext build system that Microsoft is previewing on VSO you may hit a “Unable to load task handler PowerShell for task VSBuild with version 1.0.1” error when you try to build on Windows Server Technical Preview.

Download Team Foundation Server 2015 today

Microsoft has released a CTP of TFS 2015 that includes the vNext build system. You can download TFS 2015 and try it out today. Remember that this is not a go-live version and you should not install it in production.

Unable to load task handler PowerShell for task VSBuild

After you have configured a vNext build agent you may get an error when you try and build. This error occurs regardless of the tasks that you pick for your build.

 1******************************************************************************
 2Starting Build (debug, any cpu)
 3******************************************************************************
 4Executing the following commandline:
 5C:\VsoWinAgent\agent\worker\vsoWorker.exe /name:Worker-4649b2ea-e06d-47b0-9a89-5f4aa4d545df /id:4649b2ea-e06d-47b0-9a89-5f4aa4d545df /rootFolder:"C:\VsoWinAgent" /logger:Forwarding,1.0.0;Verbosity=Verbose,Name=Agent1;JobId=4649b2ea-e06d-47b0-9a89-5f4aa4d545df
 6Unable to load task handler PowerShell for task VSBuild with version 1.0.1.
 7******************************************************************************
 8Finishing Build (debug, any cpu)
 9******************************************************************************
10Worker Worker-4649b2ea-e06d-47b0-9a89-5f4aa4d545df finished running job 4649b2ea-e06d-47b0-9a89-5f4aa4d545df

I tried to build both with the “Visual Studio Build” task and the “MS Build” tasks that come out of the box. Both resulted in the same error and I can only assume that there is an internal dependency on a particular PowerShell version that is not present.

After some investigation on Windows Server Technical Preview I noticed that only PowerShell 5 is available and enabled out of the box. Just like on Server 2008 R2, if you want an older version of PowerShell or .NET to be available then you need to go manually enable it.

Unable to load task handler PowerShell for task VSBuild

If you launch the “Add roles and features” you should see, on the features tab, an option for PowerShell with only PowerShell 5.0 installed. As this is only available in the Technical Preview my assumption would be that the team targeted the latest common version. Which would be the 2.x version.

Unable to load task handler PowerShell for task VSBuild

On Server 2012 R2 you will also find that only PowerShell 4.0 is configured by default and you will need to add PowerShell 2.0 here as well. This will in addition also enable .NET 2 / 3.5 if it has not been already.

Unable to load task handler PowerShell for task VSBuild

Although a better error message could be used, like detecting if the Windows feature is indeed enabled, this is an alfa version of the product and you don’t expect any such polish. After enabling the feature, and re-running the build…

And Poo, I still have a problem, so that’s not it. This brought me to the end of my wits and I had to go ask some folks.

Unable to load task handler PowerShell for task VSBuild

After a flurry of emails to my peers on the champs list Jakob asked if I had Unblocked the Zip files! Do what now?

It turns out that if you download a zip file from the internet it may be “partially” blocked. Windows will block access to some files that it deems risky but not warn you nor stop you from unpacking it. Unfortunately it will only partially unpack… which rendered my build agent useless.

So if you are downloading a Zip file from the internet you may need to unblock them before you can use them fully.

Unable to load task handler PowerShell for task VSBuild

Woohoo… A successful build on the new Build vNext…

Smart Classifications

Each classification [Concepts, Categories, & Tags] was assigned using AI-powered semantic analysis and scored across relevance, depth, and alignment. Final decisions? Still human. Always traceable. Hover to see how it applies.

Subscribe

Connect with Martin Hinshelwood

If you've made it this far, it's worth connecting with our principal consultant and coach, Martin Hinshelwood, for a 30-minute 'ask me anything' call.

Our Happy Clients​

We partner with businesses across diverse industries, including finance, insurance, healthcare, pharmaceuticals, technology, engineering, transportation, hospitality, entertainment, legal, government, and military sectors.​

Trayport Logo

Trayport

Teleplan Logo

Teleplan

Qualco Logo

Qualco

Bistech Logo

Bistech

Epic Games Logo

Epic Games

New Signature Logo

New Signature

Lockheed Martin Logo

Lockheed Martin

Milliman Logo

Milliman

Higher Education Statistics Agency Logo

Higher Education Statistics Agency

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

Xceptor - Process and Data Automation Logo

Xceptor - Process and Data Automation

Freadom Logo

Freadom

DFDS Logo

DFDS

Emerson Process Management Logo

Emerson Process Management

Sage Logo

Sage

Akaditi Logo

Akaditi

Illumina Logo

Illumina

Slaughter and May Logo

Slaughter and May

Ghana Police Service Logo

Ghana Police Service

Washington Department of Transport Logo

Washington Department of Transport

Royal Air Force Logo

Royal Air Force

Department of Work and Pensions (UK) Logo

Department of Work and Pensions (UK)

New Hampshire Supreme Court Logo

New Hampshire Supreme Court

Washington Department of Enterprise Services Logo

Washington Department of Enterprise Services

Akaditi Logo

Akaditi

Flowmaster (a Mentor Graphics Company) Logo

Flowmaster (a Mentor Graphics Company)

NIT A/S

SuperControl Logo

SuperControl

Healthgrades Logo

Healthgrades

Lean SA Logo

Lean SA