从源代码管理部署Azure网站期间的Web.config转换

时间:2021-03-21 20:19:42

I'm trying to get my source code to deploy automatically from source control (GitHub). Everything is working correctly with one exception - the web.config is not transforming correctly. I have the following web.config transformations set up:

我正在尝试从源代码控制(GitHub)自动部署源代码。一切正常,只有一个例外 - web.config没有正确转换。我有以下web.config转换设置:

Web.CloudLIVE.config
Web.CloudTEST.config

Web.CloudLIVE.config Web.CloudTEST.config

I am using Release configuration to build the projects in the solution. What I would like to do is specify in the App Settings in the Azure portal the correct web.config transform to apply ('CloudTEST' or 'CloudLIVE') and then have the web.config transformed correctly whenever source code is pushed to GitHub. Is it possible to do this?

我正在使用Release配置来构建解决方案中的项目。我想要做的是在Azure门户的App Settings中指定要应用的正确web.config转换('CloudTEST'或'CloudLIVE'),然后在将源代码推送到GitHub时正确转换web.config。是否有可能做到这一点?

1 个解决方案

#1


14  

I found the answer to this almost immediately after I posted the question. It is possible by adding an app setting in the Configure section of the website in the Azure Portal.

在我发布问题后,我几乎立即找到了答案。可以通过在Azure门户网站的“配置”部分中添加应用设置来实现。

The following setting will cause Kudu to transform the web.config correctly:

以下设置将导致Kudu正确转换web.config:

SCM_BUILD_ARGS    -p:PublishProfile=CloudTEST

Where CloudTEST is your web.config transform name.

CloudTEST是您的web.config转换名称。

This solution is documented here

此解决方案在此处记录

#1


14  

I found the answer to this almost immediately after I posted the question. It is possible by adding an app setting in the Configure section of the website in the Azure Portal.

在我发布问题后,我几乎立即找到了答案。可以通过在Azure门户网站的“配置”部分中添加应用设置来实现。

The following setting will cause Kudu to transform the web.config correctly:

以下设置将导致Kudu正确转换web.config:

SCM_BUILD_ARGS    -p:PublishProfile=CloudTEST

Where CloudTEST is your web.config transform name.

CloudTEST是您的web.config转换名称。

This solution is documented here

此解决方案在此处记录