Something like
msbuild /t:publish [use PublishProfileName] someproject.csproj
Publish profiles can simplify the publishing process, and any number of profiles can exist. Create a publish profile in Visual Studio by choosing one of the following paths: Right-click the project in Solution Explorer and select Publish. Select Publish {PROJECT NAME} from the Build menu.
Publish uses profiles (. pubxml files) to allow for multiple project configurations and multiple publish targets for a single project. The contents of the profile are XML and based on MSBuild. The Publish profile keeps credentials in a separate, hidden by default file that doesn't get checked-in.
Publish profile files are named <profilename>. pubxml and are located in the PublishProfiles folder. The PublishProfiles folder is under Properties in a C# web application project, under My Project in a VB web application project, or under App_Data in a web site project.
\publish sends publish output for each project to a publish folder under the folder that contains the project file. If you specify a relative path when publishing a project, the generated output directory is relative to the project file location, not to the current working directory.
msbuild MyProject.csproj /t:PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Release;_PackageTempDir=C:\temp\somelocation;AutoParameterizationWebConfigConnectionStrings=false
See MSBuild 2010 - how to publish web app to a specific location (nant)?
For Visual Studio 2012 you can use
msbuild MySolution.sln /p:DeployOnBuild=true;PublishProfile=Production;Password=foo
See ASP.NET Web Deployment using Visual Studio: Command Line Deployment
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With