Can't transform XML when deploying to VSTS

2019-08-21 03:19发布

For a VSTS worker role, I'm trying to build configuration transforms so I can change settings based on the environment.

I created two files in my solution directory, App.dev.config and App.prod.config, which I have linked to a test project. I then used this tool to apply config transforms and generate the files App.Debug.config and App.Release.config.

In my worker role's regular old app.config, I specify that app settings normally come from the App.dev.config file, so it can either remain in place or get overwritten with a tranform. <appSettings file="App.dev.config">.

In my App.Release.config file, I have the following transform to point my appSettings to read from my production definition: <appSettings file="App.prod.config" xdt:Transform="SetAttributes(file)">

My machinations work fine when I switch between debug and release configurations on my local machine. I successfully see environment variables printed out depending on whether I select "release" or "debug." However, when I deploy to VSTS and specify "release" in my BuildConfiguration variable, the log files say they're doing the transformation, but if I look at the config file on the remote machine no such transformation has occurred.

Here are my log files.

As you can see, they show that some kind of transformation succeeded:

2018-05-01T19:58:08.9166019Z App_config_AfterCompile:
2018-05-01T19:58:08.9166379Z Transforming Source File: App.config
2018-05-01T19:58:08.9311923Z Applying Transform File: App.Release.config
2018-05-01T19:58:08.9767602Z Output File: obj\Release\DeviceCloud.Application.ReportWorker.exe.config
2018-05-01T19:58:09.0006922Z Transformation succeeded

So, I'm not sure why my DeviceCloud.Application.ReportWorker.exe.config file doesn't have the transformations applied.

0条回答
登录 后发表回答