How to Fix “IsCleanMSDeployPackageNeeded” task failed unexpectedly

Microsoft .NETWhen deploying .NET projects, it’s handy to package them up using MSBuild. Recently I ran into an issue where my deployment scripts were working locally, but not on the build server (TeamCity). The error I was receiving looked like this:

C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets(2850,5): error MSB4018: The
        "IsCleanMSDeployPackageNeeded" task failed unexpectedly.

The solution

It was clear to me that something was awry on the build server, but I wasn’t sure what that might be. After looking into it, I realized that packaging your .NET projects like this utilizes Microsoft’s Web Deploy library, which must be installed on the machine.

Click here to visit Microsoft’s official Web Deploy page and download the package.

This must have already been installed on my development machine because I have IIS running; since the build server doesn’t have IIS installed, it needed the package to be installed separately.

Happy coding!