避免删除对Web文件夹发布 [英] Avoid deleting folder on Web Publish

查看:342
本文介绍了避免删除对Web文件夹发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我部署我的应用程序的Azure的网站。我已经配置了出版档案succesfuly和设置TFS preview.com利用每个code持续集成提交自动发布。

我有路径/媒体的文件夹。此文件夹中有通过CMS(一把umbraco)上传的图片和文件。此文件夹被每个Web部署删除。

从<一个href=\"http://stackoverflow.com/questions/12576662/msdeploy-skip-rules-when-using-msbuild-publishprofile-with-visual-studio-2012\">this回答,我学会了如何增加在任一.csproj的或在wpp.targets文件SkipDelete规则,但每次我发布整个文件夹被删除,反正该网站。

下面是我目前使用的内部wpp.targets的code:

 &LT;&的PropertyGroup GT;
&LT; AfterAddIisSettingAndFileContentsToSourceManifest&GT;
  AddCustomSkipRules
&LT; / AfterAddIisSettingAndFileContentsToSourceManifest&GT;
&LT; /&的PropertyGroup GT;&lt;目标名称=AddCustomSkipRules&GT;
&LT;消息文本=添加自定义规则跳过/&GT;
&LT;&的ItemGroup GT;
  &LT; MsDeploySkipRules包括=SkipMediaFolder&GT;
    &LT; SkipAction&GT;删除&LT; / SkipAction&GT;
    &LT;&的ObjectName GT;文件路径&LT; /&的ObjectName GT;
    &LT; AbsolutePath&GT;媒体和LT; / AbsolutePath&GT;
  &LT; / MsDeploySkipRules&GT;
&LT; /&的ItemGroup GT;
&LT; /目标&GT;&LT;&的PropertyGroup GT;
&LT; UseMsDeployExe&GT;真&LT; / UseMsDeployExe&GT;
&LT; /&的PropertyGroup GT;


解决方案

纵观要链接到的问题和code,你在上面提供的,看来你需要改变行:

 &LT; AbsolutePath&GT;错误日志&LT; / AbsolutePath&GT;

 &LT; AbsolutePath&GT;媒体和LT; / AbsolutePath&GT;

,因为这表示你不想删除该文件夹。 错误日志是另一个问题的作者并不想删除的文件夹。

I'm deploying my application to an Azure Website. I've configured the Publishing Profile succesfuly and setup tfspreview.com to publish automatically using continuous integration on each code commit.

I have a folder on the path "/media". This folder has pictures and documents uploaded through the CMS (umbraco). This folder gets deleted on each web deploy.

From this answer, I learned how to add a SkipDelete rule on either the .csproj or on the wpp.targets file, but everytime I publish the site the whole folder gets deleted anyway.

Here is the code I'm currently using inside wpp.targets:

<PropertyGroup>
<AfterAddIisSettingAndFileContentsToSourceManifest>
  AddCustomSkipRules
</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>

<Target Name="AddCustomSkipRules">
<Message Text="Adding Custom Skip Rules" />
<ItemGroup>
  <MsDeploySkipRules Include="SkipMediaFolder">
    <SkipAction>Delete</SkipAction>
    <ObjectName>filePath</ObjectName>
    <AbsolutePath>media</AbsolutePath>
  </MsDeploySkipRules>
</ItemGroup>
</Target>

<PropertyGroup>
<UseMsDeployExe>true</UseMsDeployExe>
</PropertyGroup>

解决方案

Looking over the question you are linking to and the code you have supplied above, it seems that you need to change the line:

<AbsolutePath>ErrorLog</AbsolutePath>

to

<AbsolutePath>media</AbsolutePath>

as this refers to the folder you do not want to delete. ErrorLog was the folder the other question's author did not want to delete.

这篇关于避免删除对Web文件夹发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆