0
votes

I have a cloud service project (.ccproj), and added a web role project(.csproj) reference to the .ccproj.

When I build the project using the below task in azure devops

- task: VSBuild@1
    displayName: Build the Solution
    inputs:
      solution: 'TestProject/TestProject.ccproj' 
      vsVersion: latest
      msbuildArgs: /t:CorePublish /p:TargetProfile=$(TargetProfile)
      platform: "AnyCPU"
      configuration: "Release"
      maximumCpuCount: true
      restoreNugetPackages: false
      msbuildArchitecture: x86

It is generating a .cspkg file (web role project) in binaries folder.

I want to do some manipulation to the in the cspkg file (Like adding a file inside the .cspkg) before it is getting generated. From which directory files the cspkg is getting generated? Also can we write any build target before it is creating .cspkg?

1
Not get your latest information, is the workaround helpful for you? Or if you have any concern, feel free to share it here.Hugh Lin

1 Answers

0
votes

The Azure deployment package file (CSPKG) file is zipped and encrypted, there isn’t the better way to add additional files. You can try to include the files in BeforeBuild target.

1.Edit web project file

2.Add BeforeBuild target before tag

Sample code:

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

VSBuild task:

msbuildArgs: /t:BeforeBuild,CorePublish /p:TargetProfile=$(TargetProfile)

You can refer to this ticket with similar issue.