How can I publish site from command line with some publish profile?
Somethin开发者_Go百科g like
msbuild /t:publish [use PublishProfileName] someproject.csproj
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
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:\Inetpub\wwwroot</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>
精彩评论