3

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?

Josh
  • 6,944
  • 8
  • 41
  • 64

1 Answers1

3

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>
Community
  • 1
  • 1
starian chen-MSFT
  • 33,174
  • 2
  • 29
  • 53
  • Hmm, is it possible to specify an absolute path in the Include attribute of the Content element? It doesn't seem to work for me. – Josh Dec 19 '16 at 16:23
  • 1
    @Josh It is working fine for me, but just files are copied (exclude folder). Anyway, you can copy necessary files to a folder through TFS build or during BeforeBuild target (https://msdn.microsoft.com/en-us/library/3e54c37h.aspx), then specify the related path. – starian chen-MSFT Dec 20 '16 at 01:36