How to fix "msdeploy.exe failed with return code: 2148734720"

January 09, 2018
Cover Image

I'm trying to deploy to an Azure AppService using an on-premise build/release agent and Team Foundation Server 2018.  This usually isn't a problem but this time was difficult.  Part of the problem is that I'm trying to run a TFS Release from an agent that's installed on Windows Server Core Build 1709.

When I ran the release, I was getting an error that said "msdeploy.exe failed with return code: 2148734720".

2018-01-09T18:33:42.6976871Z ##[error]Error: C:\agent\_work\_tasks\AzureRmWebAppDeployment_497d490f-eea7-4f2b-ab94-48d9c1acdcb1\3.3.16\MSDeploy3.6\msdeploy.exe failed with return code: 2148734720

Initially, I thought there was a problem with the "Deploy Azure App Service" task in TFS/VSTS.  The solution came from a passing comment by brady321 in this stackoverflow thread.  He suggested that this might have something to do with a requirement for .NET Framework 3.5 being installed on the machine.

Turns out he was right.

I logged in on the build server and ran the following powershell command to see if .NET 3.5 Framework was installed.

Get-WindowsFeature NET-Framework-Features

The answer was no so I installed .NET 3.5 Framework by running

Install-WindowsFeature NET-Framework-Features

After that, I re-ran the release the msdeploy worked just fine.

I hope this helps.

-Ben