Ignore file after deletion during WebDeploy

I use TeamCity to build and deploy a collection of MVC applications through msbuild and WebDeploy.

In the step prior to my build / deploy decision, I copy app_offline.htm to the deployment directory so that I can perform SQL updates and other web server management steps, including building.

One of the options in WebDeploy is to delete files that are not included in the project or are not needed to run the site. This removes the app_offline.htm file each time. Although I understand that this is kind of the desired result, is there a way to exclude this file from the deployment directory during deployment?

I tried adding an ItemGroup with the ExcludeFromPackageFiles parameter without any results.

+8
visual-studio-2010 teamcity webdeploy app- offline.htm
source share
2 answers

I had a similar problem, wanting to keep miniature javascript files in the deployment package, even if they are not part of the project.

I added a custom MSBuild target for it, which 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> 
0
source share

This other question, “ Custom file app_offline.htm at time of publication, ” offers one possible way for the end result that you describe:

I use my own

 app_offline.htm_ 

in the decision that gets published. My deployment script then renames it (removing trailing _) to make it active.

Then I can run my db / do scripts no matter what renames the site file back.

0
source share

All Articles