質問

MSBuildとWebDeployを介してMVCアプリケーションのコレクションを構築して展開するためのTeamCityを使用しています。

My Solution Build / Deployの前のステップで、app_offline.htmをdeployディレクトリにコピーして、ビルドを含むSQLの更新やその他のWeb /ソリューション管理手順を実行できるようにします。

WebDeployの設定の1つは、プロジェクトに含まれていないファイルを削除するか、サイトを実行する必要はありません。これにより、毎回my app_offline.htmファイルが削除されます。これが望ましい結果のようなものであるが、このファイルがデプロイ時に展開ディレクトリから削除されないようにする方法は?

結果なしでexcludefrompackagefilesオプションを付けてItemGroupを追加しようとしました。

役に立ちましたか?

解決

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>

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top