Visual Studio Online continuous deployment to Azure Website with publish profile

被刻印的时光 ゝ 提交于 2019-12-01 03:33:30

问题


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.

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:

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

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.

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.

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?


回答1:


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.

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.



来源:https://stackoverflow.com/questions/26548222/visual-studio-online-continuous-deployment-to-azure-website-with-publish-profile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!