Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config transform in Release when using AzureRmWebAppDeployment #4776

Closed
AmeetAB opened this issue Jul 12, 2017 · 14 comments
Closed

Config transform in Release when using AzureRmWebAppDeployment #4776

AmeetAB opened this issue Jul 12, 2017 · 14 comments
Labels
Area: AzureAppService Label to monitor Azure App Service issues Area: Release

Comments

@AmeetAB
Copy link

AmeetAB commented Jul 12, 2017

Hi,

We have a product version specific build that has a release pipeline that goes from QA -> UAT -> PROD all on Azure.

We've somehow got the config transform to execute but will issues. The issue is that it picks up the Web.Release.config even when the environment variable "ReleaseConfiguration" is set to CloudQa, CloudUat & CloudProd in the variables section. Also the task for deployment fails without any logs so I've had to literally wait for it to come to a point when it fails while watching the logs and take a printscreen. That's how we've found out that the transform is happening with Web.Release.config which does not have any transform related entries in it.

How do I force the task to transform using the "ReleaseConfiguration" value?

@vincent1173 vincent1173 added Area: Release Area: AzureAppService Label to monitor Azure App Service issues labels Jul 12, 2017
@vincent1173
Copy link
Contributor

@AmeetAB , Currently transformation is applied using Release-Environment Name.

You need to change Release Environment Name and not Release Configuration.
image

Please change the Environment name to (CloudQa, CloudUat or CloudProd).

Old Editor View:
image

@AmeetAB
Copy link
Author

AmeetAB commented Jul 12, 2017

That is what I got:

image

@vincent1173
Copy link
Contributor

vincent1173 commented Jul 12, 2017

@AmeetAB , *.Release.config is selected by default when available( in the same folder).
Order of Transformation applied is as follows: *.Release.config followed by *.<Environment_Name>.config

image

If Web.Release.config has no significance in your package, can you remove the file or provide the below tag in the same file ?

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</configuration>

@AmeetAB
Copy link
Author

AmeetAB commented Jul 13, 2017

@vincentdass applied

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
</configuration>

to both Web.Debug.config and Web.Release.config and made the CI build configuration to run on "Debug" this resulted in the release picking the environment specific config file for transformation for the web api.

We, however, also have a web job as part of the solution which we'd like deployed. Although I'm getting the webjob deployed as desired, the transformation of App.config isn't happening. Here's the log from the release:
image

It seems that the XML Transformation is looking for a Web.config and the transformation file instead of App.config. How do we handle App.config transformation? Here are the tasks in CloudProd environment:
image

And this is the config of the web job deploy task:

image

We have a lot of components using webjobs and releases with webjobs are important as part of ALM. Your help is appreciated!

@vincent1173
Copy link
Contributor

@AmeetAB, To apply transformation in App.config file, your transformation configuration files should be named App.Release.config or App.<EnvironmentName>.config

Can you please ensure that the files are present in same folder as well?

@AmeetAB
Copy link
Author

AmeetAB commented Jul 13, 2017

@vincentdass they're in a different project but at the root and in the format App..config etc

In our case, App.CloudDev.config and so on.

@vincent1173
Copy link
Contributor

@AmeetAB , can you please share the debug logs for the release (by setting variable system.debug = true)?

Need to confirm whether the artifact contains the config and transform file in the same folder.

@AmeetAB
Copy link
Author

AmeetAB commented Jul 14, 2017

@vincentdass here's some more information from my research:

I have also found another "gotcha":
On the project that contains the transformation files, this
<FilesToIncludeForPublish>AllFilesInTheProject</FilesToIncludeForPublish>
has to be entered as a sub element of this property group of the csproj file
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Our CI build runs on debug configuration so that's where I've got that entry, if someone runs CI in release mode then it has to obviously be included in that property group.

Unless the above happens, the config files are not part of the artifact package and transformation at release time cannot find the specific transform file.

With webjob kind projects, in the build, this happens:

2017-07-13T07:22:33.2974267Z _CopyAppConfigFile:
2017-07-13T07:22:33.2974267Z   Copying file from "App.config" to "bin\Debug\Transactions.WebJob.exe.config".

Obviously, at this point the App.config file has been changed into Transactions.WebJob.exe.config in the artifact package. I'm trying to apply the transformation at Release time and it cannot find the App.config or the corresponding App..config file. I can get the files to get copied over by adding but what about the App.config file getting copied into something else?

@vincent1173
Copy link
Contributor

@AmeetAB , As you mentioned App.config is renamed to "<Application_Name>.exe.config". This is done by MSBuild to match the executable application file name [Link].

You need to rename your transform files something like this

App.CloudProd.config => Transactions.WebJob.exe.CloudProd.config
App.CloudQA.config => Transactions.WebJob.exe.CloudQA.config

@AmeetAB
Copy link
Author

AmeetAB commented Jul 14, 2017

@vincentdass did what you recommended and although the files are part of the artifact, the transformation task still seems to be looking for Web.config file for transformation.

image

Transform files:
image

Actual config file:
image

@vincent1173
Copy link
Contributor

@AmeetAB , please share the debug logs for the same.

@AmeetAB
Copy link
Author

AmeetAB commented Jul 17, 2017

@vincentdass what's the best way to send you these logs?

@vincent1173
Copy link
Contributor

vincent1173 commented Jul 17, 2017

@AmeetAB , you can paste the logs here.
You can also send the logs to RM_Customer_Queries@Microsoft.com with subject as "Config transform in Release when using AzureRmWebAppDeployment #4776" for reference.

@vincent1173
Copy link
Contributor

@AmeetAB , closing the thread as there is no action item on us. (Based on the offline discussion)
Feel free to reopen or create a new issue, if required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: AzureAppService Label to monitor Azure App Service issues Area: Release
Projects
None yet
Development

No branches or pull requests

2 participants