4:15 PM: My first choice is Rm 276′s “DPR304: FAIL, Anti-Patterns and Worst Practices”, but twenty minutes before the session starts the entrance to that seminar room is already jammed with traffic. I turn around and instead enter the near-empty Rm 272, “WEB204: Microsoft Visual Studio 2010 for Web Deployment” by Vishal R. Joshi. Less laughs, but probably more applicable to my day-to-day routine.
4:20 PM: Internet access in the conference centre still doesn’t work. It’s been two or three hours now?
4:24 PM: We’re starting early! The presenter abruptly introduces himself while standing in the middle of the room, making us all search around to find him. He’s in the middle of the room.
He asks that we provide examples of what kind of setup we’ve got going, and what challenges we face with them. He picks the first person at random and forces him to speak, but after that people volunteer themselves. It runs the usual gamut of multiserver deployments with complicated XCOPY scripts. I can relate.
4:32 PM: Room is about half full.
4:37 PM: One cup of broccoli has only 43 calories. We’re told that this talk has broccoli in it. This is our fair warning that this is a unsexy topic which Vishal will try to counter by being as cheesy as possible. Thanks!
4:40 PM: An old deployment document of Vishal’s is 52 pages long, and doesn’t even have any code in it. And it uses XCOPY. Ouch.
4:41 PM: The centre of today’s discussion: Replacing XCOPY.
4:45 PM: Add Config Transforms option for Web.config: Lets you define multiple web.configs. The list shown as an example: Debug, localhost, maximumasp, release.
These multiple .config files aren’t actually Web.config files – they actually define what you are going to modify in Web.config using “transforms”:
Two key concepts to these Web.config transforms:
- One, xdt:Locator, tells the Config Transform module how to find a node: “Match(key)” matches on that node’s key
- Two, xdt:Transform, “SetAttributes(value)” sets the matched node to what’s specified in the transform
These transforms are just XML, which means you can use multiple locators if you want to get crazy (and know a bit about XML).
4:52 PM: Publish Web dialog is much expanded: Multiple publish methods; Web Deploy, FTP, File System, FPSE.
Multiple publish profiles now exist, so you don’t have to refill the publish dialog every time you change your target.
Multiple build configurations (Debug, Release) remain in the options.
4:54 PM: This transformation engine isn’t just for *.config files: It’ll work on any XML document in your project. Great!
4:55 PM: Vishal shows us the transforms: Insert, InsertAfter, InsertBefore, stuff I couldn’t type fast enough, and even custom transforms.
5:10 PM: Build Deployment Package is an option that creates a zipfile containing your project. Being a simple zipfile, it can easily be inspected. It has a manifest file, your connection strings, and does the transforms requested.
The build process finishes with a link to where the newly created package file is located.
Now you just need to copy the path of the package to your clipboard, open IIS, and click the “Import Application” option. A built-in, three-click UI to deploy websites to IIS!
Microsoft has kept in mind that some configuration settings are known only to server administrators and require their intervention. A dialog for these fill-at-deploy-time options is built in as well.
Question from the audience: Will the deployment be transactional, rolling back if it fails? Answer: Sometimes yes, sometimes no, depending on what fails.
5:15 PM: You can actually click the “Export Application” in IIS to take a deployed site and package it back into a zipfile. Handy when you need to deploy your production setup onto a second production machine.
5:18 PM: The project being used as an example actually deployed a database as well. What if we have an existing database that we don’t want to destroy as part of the redeployment process? That’s easily configurable. Updates to schemas as part of a deployment are trickier and best handled by third-party applications (DataDude).
5:20 PM: Question from the audience: Can we now encrypt our Web.config files? Answer: Not in this product (Visual Studio 2010), as Microsoft is still trying to find a generic but consistent model to do this for everyone.
5:27 PM: A Web Deploy command line tool exists to to a command line level deployment of a web package. Even has a /T flag to simulate deployment, with a report being spit out at the end of the simulation.
5:31 PM: A Parameters.xml file can be dropped within the project to define parameters that get filled in at deployment time: What files to search through and a XPATH query to use to match the node.
The same file also lets you exclude test files and folders from being deployed.
5:39 PM: Really quick notes on MS Build before the seminar ends! MS Build now lets you specify some new options:
- Deploy on build
- Create a deployment package per build
That’s it – we wrap up to take a couple of questions and are otherwise done for the day.