3

I'm using MsBuild to build and publish my project (along with CruiseControl.Net). I have set everything up and it works great but the problem is it's overwriting all my existing files in the deployed folder(and the folder contains user data, i could do an xcopy after the build/publish but the user data is a few gigs and that would be too much disk activity on each automated build).

So what I would like to do is use a "Replace only Existing files" option instead of removing everything from the folder. I get this option in Visual Studio 2010 when publishing, you can either "Replace Exiting Files" or "Delete All Files First", how to do this using the msbuild command parameters.

 <msbuild>
    <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
    <workingDirectory>C:\CCnet\dmisr-web_workingdir\MAKANI</workingDirectory>
    <projectFile>MAKANI.sln</projectFile >
    <buildArgs>/noconsolelogger /v:quiet /p:Configuration=Staging /p:DeployOnBuild=true /p:DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\dMisr\Web - Deployed" /p:AutoParameterizationWebConfigConnectionStrings=false</buildArgs>
    <targets>ReBuild</targets >
    <timeout>600</timeout >
 </msbuild>
Yehia A.Salam
  • 1,987
  • 7
  • 44
  • 93

2 Answers2

0

This answer may help

How do I keep MSDeploy from deleting extra folders in my project?

Looks like you may just need to supply an extra property to msbuild.

SkipExtraFilesOnServer=True

Community
  • 1
  • 1
Simon Laing
  • 1,194
  • 7
  • 18
  • still not working for me, it still deletes the exsiting files – Yehia A.Salam Oct 17 '12 at 11:08
  • Just to confirm, your build args are now equivalent to: `/noconsolelogger /v:quiet /p:Configuration=Staging /p:DeployOnBuild=true /p:DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="c:\dMisr\Web - Deployed" /p:AutoParameterizationWebConfigConnectionStrings=false /p:SkipExtraFilesOnServer=true` ? – Simon Laing Oct 18 '12 at 07:06
0

/p:SkipExtraFilesOnServer=true is still removing other files for me when using these build arguments /p:DeployOnBuild=true;DeployTarget=PipelinePreDeployCopyAllFilesToOneFolder;_PackageTempDir=\\Network\Share\code /p:AutoParameterizationWebConfigConnectionStrings=false /p:SkipExtraFilesOnServer=true

I do not seem to have the ability to comment. Hence providing my comments in the answer section.

Kalyan
  • 488
  • 6
  • 17