Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Online continuous deployment to Azure Website with publish profile

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?

like image 759
bigbearzhu Avatar asked Sep 30 '22 13:09

bigbearzhu


1 Answers

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.

like image 63
user4192375 Avatar answered Oct 07 '22 04:10

user4192375