1

Good day!

I've found this solution here: VS2010 Web Publish command line version of File System deploy

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe 
.\MyProject.csproj /p:Configuration=Release;DeployOnBuild=True;PackageAsSingleFile=False;outdir=c:\_OuputDir\

But it seems that Web.config transformations are not performed.

May be there is better\cleaner way to duplicate "Publish Web" VS2010 dialog?

Update: The answer which is marked is the shortest command-line to perform publish, that I've found so far. Web.config transformations ARE applied, but connection strings are treated differently, here is a description\workaround

Community
  • 1
  • 1
artvolk
  • 9,448
  • 11
  • 56
  • 85

3 Answers3

1

My solution for CCNET with the Web.config transformation:

<tasks>
    <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
        <workingDirectory>E:\VersionesCC\Trunk_4\SBatz\Gertakariak_Orokorrak\GertakariakMS\Web</workingDirectory>
        <projectFile>GertakariakMSWeb2.vbproj</projectFile>
        <targets>Build</targets>
        <timeout>600</timeout>
        <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
        <buildArgs>
            /noconsolelogger /p:Configuration=Release /v:diag
            /p:DeployOnBuild=true
            /p:AutoParameterizationWebConfigConnectionStrings=false
            /p:DeployTarget=Package
            /p:_PackageTempDir=E:\Aplicaciones\GertakariakMS2\Web
        </buildArgs>
        </msbuild>
</tasks>
Asier
  • 57
  • 1
  • The parameter "/p:AutoParameterizationWebConfigConnectionStrings=false" was new for me. I've added it to the MSBUILD commandline and it did the trick. – Prutswonder Jul 30 '14 at 14:08
1

Excerpt from: http://ashwaniksharma.spaces.live.com/Blog/cns!AD160FFA5932F17E!206.entry

MSBuild .\MyProject.csproj /t:TransformWebConfig;/p:Configuration=Release;DeployOnBuild=True;PackageAsSingleFile=False;outdir=c:\_OuputDir\
im_nullable
  • 555
  • 1
  • 6
  • 17
  • It looks like it should done what I'm looking for, but I've got the following message and nothing changes: `TransformWebConfigCore: Skipping target "TransformWebConfigCore" because all output files are up-to-date with respect to the input files.` – artvolk Feb 28 '11 at 11:55
  • It seems the transformed web.config is placed under obj\\TransformWebConfig\transformed in the MVC app folder when you do this command. Not sure what ties this together and produces the final package as publish in Visual Studio does. – Derek Morrison Mar 01 '11 at 11:03
1

This might work (which I found here):

msbuild solution.sln /p:Configuration=Release;DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=..\publish

However, it gave me the following error when I tried to run it (which I'm still working to fix):

C:\[path]\[config]\csautoparameterize\original\web.config(40): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

Derek Morrison
  • 5,456
  • 4
  • 31
  • 24
  • It works for me to make a publish (that's the shortest and the cleanest way to get output to separate folder), but Web.config is not transformed, here how my connection string looks after publish `` – artvolk Mar 02 '11 at 14:06
  • update: all my transformations except connection strings are processed!!! Is there any way to get it to work for connection strings? It seems to be by design: http://forums.asp.net/p/1569934/4043217.aspx – artvolk Mar 02 '11 at 14:11