Tutorial :How can I publish site from command line with some publish profile?



Question:

Something like

msbuild /t:publish [use PublishProfileName] someproject.csproj


Solution:1

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


Solution: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:\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>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »