我在CruiseControl.net构建和部署脚本中使用了_WPPCopyWebApplication MSBuild目标,但看起来这个目标在部署之前清除了不属于项目的文件 - 特别是App_Data文件(对于这个应用程序,包括上传的图像)等).
来自Microsoft.Web.Publishing.targets;
<OnBefore_WPPCopyWebApplication>
$(OnBefore_WPPCopyWebApplication);
CleanWebProjectOutputDir;
PipelineTransformPhase;
</OnBefore_WPPCopyWebApplication>
Run Code Online (Sandbox Code Playgroud)
在给定此目标的情况下,如何阻止它执行CleanWebProjectOutputDir;
<Target Name="Deploy" DependsOnTargets="Tests">
<MSBuild Projects="$(TargetPath)Website.csproj" Properties="Configuration=Debug;WebProjectOutputDir=\\servername\share;Outdir=$(ProjectDir)bin\;" Targets="ResolveReferences;_WPPCopyWebApplication" />
</Target>
Run Code Online (Sandbox Code Playgroud)
这是来自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)" />
Run Code Online (Sandbox Code Playgroud)
所以我想问题就变成了,我怎么能抑制这个特定的删除任务,或者至少将App_Data**添加到_AllExtraFilesUnderProjectOuputFolder排除?