views:

185

answers:

2

Something like

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

+2  A: 
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)?

Pavel Chuchuva
My web.config ends up like this after running that msbuild command: <connectionStrings> <add name="principal" connectionString="$(ReplacableToken_principal-Web.config Connection String_0)" providerName= ..
Jhonny D. Cano -Leftware-
@Jhonny You need AutoParameterizationWebConfigConnectionStrings parameter, I've updated my answer.
Pavel Chuchuva
@Pavel It worked fine for me, thank you very much !!
Jhonny D. Cano -Leftware-
A: 

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"&gt;
    <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>
Jhonny D. Cano -Leftware-