How can I include additional files in an Azure cloud services package when using VSTS?

爷,独闯天下 提交于 2021-02-10 06:28:08

问题


I have a solution with a web project in it and a cloud project for deploying that web project as a cspkg file to a cloud service. This all works fine. However, I have a file that i don't want in the web project but I do want deployed with the cspkg file into the cloud service.

We use VSTS to build and deploy things, and I haven't figured out how to include extra files in the package within this system. I tried a Copy Files step but that doesn't get the file into the package, it does get it into the artifacts though. I tried other things I found online, like the PipelineCollectFilesPhaseDependsOn injection technique, but nothing seems to work.

Is this possible, and if so, how can it be done?


回答1:


The Azure deployment package file (CSPKG) file is zipped and encrypted, there isn’t the better way to add additional files (More details: Include/Exclude files when creating Azure package). But you can include the files in BeforeBuild target. For this way, you don’t need to include files to the web project.

For example:

  1. Edit web project file (e.g. WebRole1.csproj)
  2. Add BeforeBuild target before tag.

Code:

<Target Name="BeforeBuild">
    <ItemGroup>
      <Content Include="Files\TT.txt">
        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      </Content>
    </ItemGroup>
  </Target>


来源:https://stackoverflow.com/questions/41184725/how-can-i-include-additional-files-in-an-azure-cloud-services-package-when-using

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