Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)?

like image 879
Ivan Zlatev Avatar asked Feb 25 '13 13:02

Ivan Zlatev


People also ask

How do I publish with MSBuild?

You can pass /p:PublishUrl="newpath" to the msbuild command. You would also see this set in the csproj file which you can change.

What is publish profile in MSBuild?

A publish profile is just an MSBuild file. When you pass in PublishProfile and DeployOnBuild=true, then the publish profile is Imported into the build/publish process. It will supply the publish properties needed to perform the publish. Let's see how that works.

How do I import a publishing profile into Visual Studio code?

Import the publish settings in Visual Studio and deployClick New or Create new profile. Select the option to import a profile. In the Publish dialog box, click Import Profile. Navigate to the location of the publish settings file that you created in the previous section.


1 Answers

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.

like image 133
Isantipov Avatar answered Sep 23 '22 07:09

Isantipov