asp.netmsbuildpackagemsdeploy

Web Deploy ignores SkipExtraFilesOnServer set by MSBuild


I'm using MSBuild to create a Web Deploy Package on our CruiseControl Server to Deploy our web applications. On deployment everything not in the package will be deleted on our servers.

I tried the option SkipExtraFilesOnServer option set to true. But it is ignored by Web Deploy

<Target Name="CreateDeploymentPackage">
    <MSBuild Projects="$(Web)" Targets="Package"
      properties="Platform=$(Platform);
      Configuration=$(Configuration);
      DeployOnBuild=False;
      DeployTarget=Package;
      SkipExtraFilesOnServer=True;
      MSDeployUseChecksum=True;
      PackageLocation=$(DeployDirectory)\_PublishedWebsites\DeployPackage\$(CurrentProject).zip;
      PackageAsSingleFile=True;
      _PackageTempDir=$(PackageOutputDir)\temp;">
    </MSBuild>
</Target>

Why is this not working? Every documentation I find says it should.


Solution

  • I'm not following you 100% but, I think I understand what's happening here. Here is my understanding of your situation.

    You've configured your build server to do the following.

    1. Build a web deploy package using msbuild.exe
    2. You've set SkipExtraFilesOnServer=true when creating the package
    3. Publish the web deploy package using msdeploy.exe

    The issue that you are likely running into is when the package is published to the server. When pass SkipExtraFilesOnServer=true is translated to the msdeploy option -enableRule:DoNotDeleteRule. Which is applied (and relevant) when publishing to the package in your case. Now you need to ensure that option is set when the package is published to the server. That option is not embedded in the package in anyway.