How to automate Web Deploy of a specific Publish Profile with an MSBuild script?

Ivan Zlatev picture Ivan Zlatev · Feb 25, 2013 · Viewed 8.1k times · Source

I have a Visual Studio 2012 solution, which contains three web projects. Each of them has a web deploy publish profile, which creates a package in a specific directory. The solution itself also has a special Deployment configuration.

Using msbuild, building the solution in a Deployment configuration is easy, but how can I publish the 3 web projects using a specific profile using an msbuild build script/task (rather than invoking command lines)?

Answer

Isantipov picture Isantipov · Feb 26, 2013

I think you can try the following:

msbuild.exe MyProject.csproj /p:DeployOnBuild=true;PublishProfile=MyProfile

as pointed by Steve, this post by Sayed Ibrahim Hashimi seems to address your requirement publish from an msbuild in detail.