开发者

How to stop MSBuild _WPPCopyWebApplication target cleaning App_Data folder

开发者 https://www.devze.com 2023-02-08 08:01 出处:网络
I\'m using the _WPPCopyWebApplication MSBuild target in a CruiseControl.net build-and-deploy script, but it appears that this target cleans files not part of the project before the deployment - specif

I'm using the _WPPCopyWebApplication MSBuild target in a CruiseControl.net build-and-deploy script, but it appears that this target cleans files not part of the project before the deployment - specifically, App_Data files (which for this app, include uploaded images, etc).

From Microsoft.Web.Publishing.targets;

<OnBefore_WPPCopyWebApplication>
    $(OnBefore_WPPCopyWebApplication);
    CleanWebProjectOutputDir;
    PipelineTransformPhase;
</OnBefore_WPPCopyWebApplication>

How can I stop it doing the CleanWebProjectOutputDir, given this target;

<Target Name="Deploy" DependsOnTargets="Tests">
    <MSBuild Projects="$(TargetPath)Website.csproj" Properties="Configuration=Debug;WebProjectOutputDir=\\servername\share;Outdir=$(ProjectDir)bin\;" Targets="ResolveReferences;_WPPCopyWebApplication" />
</Target>

This is from a VS2010 solution, albeit built under CC.Net; I'm aware of MSDeploy, but haven't got my head around that fully yet, so would prefer to stick with MSBuild/_WPPCopyWebApplication for now.

EDIT:

I've further narrowed this to this part of the target;

<!-- In the case of the incremental Packaging/Publish, we need to find out the extra file and delee them-->
<ItemGroup>
    <_AllExtraFilesUnderProjectOuputFolder Include="$(WebProjectOutputDir)\**" />
    <_AllExtraFilesUnderProjectOuputFolder Remove="@(FilesForPackagingFromProject->'$(WebProjectOutputDir)\%(DestinationRelativePath)')" />
</ItemGroup>
<!--Remove all extra files in the temp folder that's not in the @(FilesForPackagingFromProject-->
<Delete Files="@(_AllExtraFilesUnderProjectOuputFolder)" />

So I guess the question becomes, how can I supress this specific Delete task, or at least add App_Data** to the _AllExtraFilesUnderProjectOuputFolde开发者_如何学运维r exclusions?


Add CleanWebProjectOutputDir=False to your properties:

<Target Name="Deploy" DependsOnTargets="Tests">
    <MSBuild Projects="$(TargetPath)Website.csproj" Properties="Configuration=Debug;CleanWebProjectOutputDir=False;WebProjectOutputDir=\\servername\share;Outdir=$(ProjectDir)bin\;" Targets="ResolveReferences;_WPPCopyWebApplication" />
</Target>
0

精彩评论

暂无评论...
验证码 换一张
取 消