Amitabh
Amitabh

Reputation: 61187

How to publish an Asp.Net MVC 2 application using commandline?

In Visual Studio 2010 we can right click a Web application and select Publish from the Menu. Using this we can publish a web application to a File System.

How can we achieve the same using Command line?

EDIT: Although we can use xcopy as suggested it is not same as Publish command as we have to manually exclude unnecessary files.

Upvotes: 0

Views: 1035

Answers (3)

Tom Anderson
Tom Anderson

Reputation: 10827

You can pass optional properties to the MSBuild script to call MSDeploy (Assuming you have it setup on both the client/server).

/p:DeployOnBuild=True – This will let us deploy after build

/p:DeployTarget=MsDeployPublish – This set how we will deploy, using MSDeploy

/p:MSDeployServiceURL=http:///MsDeployAgentService

/p:DeployIISAppPath="Default Web Site" – The path where the app will be deployed

/p:CreatePackageOnPublish=True – Create a package to deploy the App

/p:MsDeployPublishMethod=RemoteAgent – Server where the MSDeploy is installed. The possible values for this are:

RemoteAgent – When the MSDeploy is deployed at another machine

InProc – Deploy to the Local IIS

/p:AllowUntrustedCertificated=True – Connect to the MSDeployServiceURL without trying to use certificate.

To use a certificate you should use another URL on the MSDeployServiceURL.

/p:UserName=username – The username of a user with permission to Deploy the application

/p:Password=password – a VALID password for that user :)

Taken from Allmatech ALM Team

Upvotes: 2

mcdon
mcdon

Reputation: 5049

You're looking for Aspnet_compiler.exe to publish using the command line.

If using MSBuild then you need the AspNetCompiler Task.

The options the Aspnet_compiler provides are the same as those provided by Visual Studio's Publish option.

Upvotes: 2

Henrik
Henrik

Reputation: 3704

Have you tried something like this

xcopy *.* \\server\folder

Upvotes: 0

Related Questions