Something like
msbuild /t:publish [use PublishProfileName] someproject.csproj
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
msbuild MyProject.csproj /t:PipelinePreDeployCopyAllFilesToOneFolder /p:Configuration=Release;_PackageTempDir=C:tempsomelocation;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
Method 2
This is an alternative solution for achieving Pavel’s solution but using MsBuild target in a MsBuild file:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Release</Configuration>
<OutputDirectory>$(DeploymentProject)bin$(Configuration)</OutputDirectory>
<OutputPath>C:Inetpubwwwroot</OutputPath>
</PropertyGroup>
<Target Name="build">
<MSBuild
Projects="Your Solution File.sln"
Properties="Configuration=$(Configuration);DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=$(OutputPath);AutoParameterizationWebConfigConnectionStrings=false"
>
</MSBuild>
</Target>
</Project>
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0