簡體   English   中英

VSTS構建定義-添加其他文件以構建輸出

[英]VSTS Build Definition - add additional files to build output

使用RMO,我創建了一個Visual Studio構建定義。 在“復制文件”步驟中,如果我將內容設置為

**\*.zip

它會創建我的已編譯項目的zip文件以及web.config文件。 我需要向此zip文件中添加一些其他配置文件,這些文件是解決方案級別文件夾,而不是項目文件夾中。 在預構建事件中,這3個文件將復制到項目文件夾中。 因此,我無法為這些文件設置Build Action = Content。

您可以在項目文件中添加以下代碼,以在構建過程中在zip文件中包含其他文件:

<Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="PathToExtraFile" />
        <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
          <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
        </FilesForPackagingFromProject>
      </ItemGroup>
  </Target>

  <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>
  </PropertyGroup>

有關詳細信息,請參考此鏈接: 使用Visual Studio的ASP.NET Web部署:部署額外的文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM