sayedihashimi / slow-cheetah

XML Transforms for app.config and other XML files
Other
242 stars 51 forks source link

Transform is not applied when publishing a console application as an Azure Web Job #240

Closed urig closed 7 years ago

urig commented 7 years ago

Slow Cheetah transforms do not seem to be working for me when I publish a console application as an Azure WebJob from Visual Studio.

Steps to reproduce:

  1. Using Visual Studio 2015 with SlowCheetah v2.5.48 and Azure .Net SDK v2.9.6:
  2. Given a console application, use Slow Cheetah to add a config transform to it. Ex: App.dev.config
  3. In the Solution Explorer, right-click the project and choose "Publish as Azure WebJob"
  4. Use the Publish wizard that opens up to create a new publish profile with the same name as that of the config transform from step 2 (Ex: dev)
  5. Use the Publish wizard to publish the app as a web job to an Azure app service.

Expected result:

The config transform should be applied and the results should be seen in the .exe.config in the app service.

Actual result:

The results are not seen in the .exe.config in the app service. Instead, the content of the base .config file is present as if the transform was not applied.

Not sure if this Slow Cheetah's responsibility but if it isn't would love to know what the right approach might be to resolve. Thanks!

urig commented 7 years ago

UPDATE: I've asked this question over on StackOverflow. An answer suggested a workaround of creating a build configuration with the same name as my publish profile and using that when publishing.

The workaround seems to be working. Still, I would like to ask for SlowCheetah to work without requiring the user to resort to this trick. Thanks.

davilimap commented 7 years ago

As I mentioned in #195, VS usually defaults your publish configuration to be Release, so on publish the App.Release.config transformation will be applied, if present. The workaround of using a build configuration with the same name as the publish profile works because SlowCheetah first applies the build configuration transformation (which would still be Release) then it looks for App.$(PublishProfile).config and applies that transformation. This needs to be documented and is being worked on, thanks for reporting this behavior. If this is not the problem that you encountered, reopen the issue and I'll take a closer look at it.