【问题标题】:How to stop MSBuild _WPPCopyWebApplication target cleaning App_Data folder如何停止 MSBuild _WPPCopyWebApplication 目标清理 App_Data 文件夹
【发布时间】:2011-05-25 23:47:01
【问题描述】:

我在 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 排除项?

【问题讨论】:

    标签: deployment msbuild cruisecontrol.net


    【解决方案1】:

    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>
    

    【讨论】:

    • 天哪,我找这个属性好久了,你知道在哪里可以找到 msbuild 属性列表吗?
    猜你喜欢
    • 2014-10-05
    • 2014-10-04
    • 1970-01-01
    • 2018-01-15
    • 1970-01-01
    • 1970-01-01
    • 2012-07-30
    • 2020-06-23
    • 1970-01-01
    相关资源
    最近更新 更多