سؤال

When I build and deploy using Visual Studio, I can choose to 'remove additional files at destination'.

How can I do this with MSBuild? As the additional files will vary, I can't just use the Remove and RemoveDir tasks.

هل كانت مفيدة؟

المحلول

If you have a publish profile (.pubxml), I believe using this is analagous to checking the 'remove additional files at destination'

<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>

Then referencing the Publish Profile in msbuild:

<MSBuild Projects="proj.csproj"
         Targets="WebPublish"
         Properties="VisualStudioVersion=11.0;
          Configuration=$(Configuration);
          PublishProfile=$(Configuration).pubxml;
          MSDeployServiceUrl=$(ServiceUrl);
          UserName=$(MSDeployUsername);
          Password=$(MSDeployPassword)"  />

If not using publish profile, I'd think just adding the SkipExtraFilesOnServer=False in the build task properties would do the trick.

نصائح أخرى

You pass another property to msbuild:

<Target Name="Deploy" DependsOnTargets="Build">
        <MSBuild Projects="MyProject.sln" Properties="...SkipExtraFilesOnServer=False..."/>
</Target>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top