1
votes

I have a webjob and a webapp (both separate projects), I would like to build one artifact for all environments and do the transformations during the release step rather than build, as that way I have to create an artifact per environment. So I am creating two separate artifacts (one for webapp and one for webjob) per environment and applying the xml transforms during publish to the app service, now everything works fine, except that the transformed file for the webjob is placed in the root directory of the webapp, which is not what I intend to do. I would like the file to be placed as app_data\jobs\continous\myjob\myjob.exe.config

I've seen the slow cheeta and CTT transforms, but those are out of the scope of this question as they do transform only on build.

enter image description here

2

2 Answers

1
votes

You can use Kudu api to run the commands to copy or delete files.

More information about how to call kudu api during build/relase, you can refer to: How to access Kudu in Azure using power shell script

0
votes

You should transform during build and your transformation should happen as tokens in the build rather than actual target values. Then in deployment you can replace the token values with actual target environment values. That is the proper approach for packaging and deployment of any application type.

Steps should be

  1. In build tokenize the configurations with transformation (use this extension task)
  2. Package tokenized configurations as build output
  3. At deployment apply target values to tokens (use replace tokens task comes with marketplace extension, which replaces values of defined configs with release variable values by mapping names automatically. in other words token should be the parameter name)

Here is an example done on a windows service. But it is applicable for webjobs (have tested this) as well and it is the proper solution.