使用发布配置文件将 Visual Studio Online 持续部署到 Azure 网站 [英] Visual Studio Online continuous deployment to Azure Website with publish profile

查看:21
本文介绍了使用发布配置文件将 Visual Studio Online 持续部署到 Azure 网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 CI 构建通过后,我正在使用 Visual Studio Online 持续部署我的项目.但是,我必须使用发布配置文件来构建生产 web.config 转换,以便部署的网站将使用生产数据库而不是开发数据库.我已按照 Scott Hanselman 的博客文章 在 CI 构建定义中添加 MSBuild 参数.我的论点是这样的:

I am using Visual Studio Online to deploy my project continuously after the CI build pass. However I have to use a publish profile to build the production web.config transform so that the deployed website will be using the production DB instead of dev DB. I have followed Scott Hanselman's blog post to add the MSBuild arguments in the CI build definition. My arguments are like this:

/p:DeployOnBuild=true /p:PublishProfile=[publish profile name] /p:AllowUntrustedCertificate=true /p:UserName=[credentials obtained from Azure Website portal] /p:Password=[from the portal as well]

看起来工作正常,部署的网站现在正在使用生产数据库.

It seems working, the deployed website is using production DB now.

然后我注意到在部署部分下的 CI 构建定义中,有一个参数称为:部署设置路径.来自这篇文章,它说:

Then I noticed that in the CI build definition under the Deployment section, there is one parameter called: Path to Deployment Settings. From this article, it says:

网站的 .pubxml 文件的路径,相对于存储库的根文件夹.云服务忽略."

"The path to your .pubxml file for a website, relative to the root folder of the repo. Ignored for cloud services."

这正是我想要的.所以我删除了 MSBuild 参数,通过在弹出窗口中选择 pubxml 文件来设置部署设置的路径,然后再试一次.

Which is exactly what I want. So I removed the MSBuild arguments, set the Path to Deployment Settings by select the pubxml file in the popup, and give it another try.

然而,这种既好又简单的方法根本行不通.即使指向同一个pubxml文件,而且两种方式都得到了绿色的CI构建,但后面的好像还是使用默认的web.config而不是部署后转换的.

However, this nice and simple way doesn't work at all. Even if it is pointing to the same pubxml file, and both ways got green CI builds, the later one seems still use the default web.config not the transformed one after deployment.

所以我很好奇是否有人知道 MSBuild 参数中的 PublishProfile 和 Path to Deployment Settings 之间有什么区别?我使用正确的方法来做到这一点吗?

So I am curious if anyone know what is the difference between the PublishProfile in MSBuild arguments and Path to Deployment Settings? Am I using the right way to do this?

推荐答案

我遇到了同样的问题.我发现部署设置路径"设置了 MSBuild 参数/p:PublishProfilePath".您可以在构建的诊断日志中看到这一点.不过,我不确定 PublishProfilePath 参数的作用.

I had the same problem. I found that "Path to Deployment Settings" sets the MSBuild parameter "/p:PublishProfilePath". You can see this in the Diagnostic log of the build. I'm not sure what the PublishProfilePath parameter does though.

但我得到了以不同方式工作的转换.在构建"部分,我将配置"设置为使用发布配置.通过 VSO 构建发布似乎应用了配置的转换.

But I got transforms working a different way. In the "Build" section, I set "Configurations" to use the Release configuration. Publishing through VSO build seems to apply the transform for the config.

这篇关于使用发布配置文件将 Visual Studio Online 持续部署到 Azure 网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆