【问题标题】:VSTS Build Definition - add additional files to build outputVSTS 构建定义 - 添加其他文件以构建输出
【发布时间】:2016-12-29 19:52:20
【问题描述】:

使用 RMO,我创建了一个 Visual Studio 构建定义。在复制文件步骤中,如果我将内容指定为

**\*.zip

它会创建我编译项目的 zip 文件以及 web.config 文件。我需要在这个 zip 中添加一些额外的配置文件,它们是解决方案级别的文件夹,而不是项目文件夹中。这 3 个文件在预构建事件中被复制到项目文件夹中。所以我不能为这些文件设置 Build Action = Content。

【问题讨论】:

    标签: azure-devops ms-release-management azure-pipelines


    【解决方案1】:

    您可以将以下代码添加到项目文件中,以便在构建期间将额外文件包含在 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>
    

    详情请参考此链接:ASP.NET Web Deployment using Visual Studio: Deploying Extra Files

    【讨论】:

      猜你喜欢
      • 2012-01-25
      • 1970-01-01
      • 2018-05-24
      • 2023-03-26
      • 2018-06-13
      • 1970-01-01
      • 2021-01-07
      • 1970-01-01
      • 2017-02-22
      相关资源
      最近更新 更多