MSBuild target package not found

I want to package my VS2010 web application project ready for deployment with msdeploy. On development machine I can do this using:

MSBuild.exe "C:\path\to\WebApp.csproj" /target:package

But on my build server I get this error:

error MSB4057: The target "package" does not exist in the project.

What am I missing on the build server?


Solution 1:

I just got this working without installing VS2010 by following these steps on the build server:

  1. If .NET Framework 4 isn't installed, install it
  2. Install the Web Deployment tool from http://www.iis.net/download/webdeploy
  3. From the C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0 folder on your dev machine copy the "Web" and "Web Applications" folders to the equivalent directory on your build server.

This seems to work for me

Solution 2:

I know it's an old question, but I recently ran into the same issue and none of the answers helped. I was missing following file on my build server:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio
    \v11.0\Web\Microsoft.Web.Publishing.targets

It is imported by:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio
    \v11.0\WebApplications\Microsoft.WebApplication.targets

Hope this helps someone like me :)

Solution 3:

You may install MSBuild.Microsoft.VisualStudio.Web.targets package. No need to manually copy targets to build server.