Question

I have the following build target set to do my deploys, as mentioned by Hanselman in his Tiny Happy Features #3 and as also noted in many other places as what I consider to be the recommended approach:

msbuild my_web_application.csproj /p:Configuration=Production;
                                     DeployOnBuild=true;
                                     PublishProfile=Production;
                                     VisualStudioVersion=11.0;
                                     AllowUntrustedCertificate=true;
                                     AuthType=NTLM

This does the job, and replaces the deployment step I previously had via invoking ms deploy on the command line:

msdeploy.exe" -source:package="c:\source_to_my_web_application.zip" -dest:auto,my_server_name,includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"c:\source_to_my_web_application\Package.SetParameters.xml"

The biggest difference I can see in the two methods is that the command line call will only push over the files that have modifications, whereas the msbuild call sends over the entire web application every time.

Is there a way to make the msbuild version do the "sync" behavior, like the direct call to msdeploy did for me?

Was it helpful?

Solution

From what I've been able to establish, syncing from a package (like the one created for this particular MSBuild command) will find differences related to the local working copy it's trying to deploy from.

If I do a fresh checkout, then build and deploy, it'll publish the entire web application.

If I do a clean and rebuild on that working copy, it'll only publish the dlls that got rebuilt.

If I do a build on that, it'll only publish the web.config files that got transformed and some other random dlls that I can't make rhyme or reason out of.

The bottom line, I guess, is that with our CI server setup, it should be assumed that all files will be published to the server, and if it happens to publish fewer than that, it's a bandwidth bonus.

As a side note, I've also encountered random, unreliable 404 errors while doing otherwise normal ms deploy commands. They seem to be intermittent, and can vary between my own workstation, my colleagues, and the CI server so that the MS Deploy service will return a 404 or execute just fine within seconds of each successive call. Solutions I've found for this type of behavior range from restarting Visual Studio to uninstalling and reinstalling various components, and making sure you do it in the right order and only the second Tuesday of the third week of any month ending in "ary"...

The takeaway for me is that this tool is sketchy, and that if you can get a setup to work with any amount of reliability it's a miracle and you should not touch it ever again and pray to the silicon gods that it stays that way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top