Ignore file from delete during WebDeploy

风流意气都作罢 提交于 2019-12-05 05:12:21

I had a similar problem, wanting to keep minified javascript files in the deployment package even though they're not part of the project.

I added a custom MSBuild target for this, that works for me:

<!-- ====== Package the minify files ===== -->

 <PropertyGroup>
  <CopyAllFilesToSingleFolderForPackageDependsOn>
    CustomCollectFiles1;    
    $(CopyAllFilesToSingleFolderForPackageDependsOn);
  </CopyAllFilesToSingleFolderForPackageDependsOn>
 </PropertyGroup>

 <PropertyGroup>
   <AfterAddIisSettingAndFileContentsToSourceManifest>
    MakeEmptyFolders
   </AfterAddIisSettingAndFileContentsToSourceManifest>
 </PropertyGroup>

<Target Name="CustomCollectFiles1">
  <ItemGroup>
   <!-- =====Controls\Javascript folder ==== -->
    <_CustomFilesForRootFolder Include=".\Controls\Javascript\*.min.js">
    <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)    </DestinationRelativePath>
   </_CustomFilesForRootFolder>
  <FilesForPackagingFromProject Include="%(_CustomFilesForRootFolder.Identity)">
    <DestinationRelativePath>.\Controls\Javascript\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
  </FilesForPackagingFromProject>
 </ItemGroup> 
</Target>
Meligy

This other question " Custom app_offline.htm file during publish " suggests one possible way for the final result you describe:

I use my own

app_offline.htm_

file in the solution, which gets published. My deployment script then renames it (removing the trailing _) to make it active.

I can then run my db scripts/do whatever then rename the file bringing the site back.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!