问题
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:
- Edit web project file (e.g. WebRole1.csproj)
- 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