如何停止MSBuild _WPPCopyWebApplication目标清理App_Data文件夹

8
我正在使用CruiseControl.net的构建和部署脚本中的_WPPCopyWebApplication MSBuild目标,但是似乎该目标在部署之前会清理不属于项目的文件,特别是App_Data文件(对于此应用程序,包括上传的图像等)。
来自Microsoft.Web.Publishing.targets;
<OnBefore_WPPCopyWebApplication>
    $(OnBefore_WPPCopyWebApplication);
    CleanWebProjectOutputDir;
    PipelineTransformPhase;
</OnBefore_WPPCopyWebApplication>

如何停止执行 CleanWebProjectOutputDir,针对此目标;

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

这是来自VS2010解决方案的内容,尽管是在CC.Net下构建的;我知道有MSDeploy,但还没有完全理解,所以现在更喜欢使用MSBuild/_WPPCopyWebApplication。
编辑:
我已经进一步缩小了目标范围,只限于该部分;
<!-- 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)" />

那么问题就变成了,我该如何抑制这个特定的删除任务,或者至少将App_Data**添加到_AllExtraFilesUnderProjectOuputFolder排除列表中呢?

1个回答

10

CleanWebProjectOutputDir=False添加到您的属性中:

<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>

1
天啊,我已经找了好久这个属性了,你知道在哪里可以找到msbuild属性列表吗? - Johnny_D

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接