Web Publish Updates with Windows Azure SDK 1.8
We recently released new updates to the publishing experience in Visual Studio 2012 and Visual Studio 2010 as part of the Windows Azure SDK for .NET 1.8 release. The main new features include web site project (WSP) publishing using the same new publishing workflow as web application projects (WAPs), precompile options for both WAP and WSP, per publish profile web.config transforms, and a preview of the selective publishing feature we’ll be releasing in the next publish update. You can get the new publish updates by installing the Windows Azure SDK for .NET 1.8 package from the Web Platform Installer.
The first big feature of this publish update is full support for publishing your web site projects. Previously, when you wanted to publish a WSP, you either needed to copy all of the files in your project to your hosting server every time you deployed or pick out just the changed files and manually update those. If you wanted to use Web Deploy to incrementally deploy your web site project changes, you needed to set up a separate Web Deployment project in your solution. All of that has now been replaced with the one unified publish dialog that you saw for WAPs in the Visual Studio 2012 release:
Since both WAPs and WSPs use this new publish dialog, there is now just one simple experience when you want to publish your project, regardless of what type it is. This means that WSPs get all of the great publish features that was previously available only for WAP including:
- Choose your desired publish method among Web Deploy, Web Deploy Package, FTP, File System, FPSE
- Create multiple publish profiles (*.pubxml files)
- Command line publishing with Web Deploy that can be used from a CI server
- Web.config tranforms
- Incremental publishing of your database schema
- Publishing your EF code first migrations
- File and database preview
If you would like more details on these features, see http://blogs.msdn.com/b/webdev/archive/2012/06/15/visual-studio-2010-web-publish-updates.aspx.
There are some small differences, however, since WSPs are a completely different project type. First, since WSPs do not have a project file and MSBuild needs one to perform the web publishing tasks, there will be a new file called website.publishproj created in your website. Since it is a design time config file, it will not be published with your web site content. The website.publishproj files is basically a stripped down MSBuild project file that contains only the properties need for web site publishing. You can see a sample of it here:
Another difference with WSPs is that it does not have a Properties page (or folder) and so your PublishProfiles with any .pubxml you create are instead stored in App_Data:
Lastly, you may notice when publishing a WSP that there is only have a Debug configuration. This is because WSPs usually don’t have any dlls in the bin folder and thus no pdbs either so there is no difference between a Debug and Release configuration. However, if you reference a class library, then a Release configuration will become available since the reference class has a dll.
The next new feature in this release is the ability to specify precompile options for your WSP and WAP from the new publish dialog. These are the same precompile options that were available in the old publish web site UI and WAP properties page, but now they can be conveniently set in the new publish workflow. Clicking the Configure link next to Precompile during publishing brings up the Advanced Precompile Settings dialog:
Notice also the new File Publish option to Exclude files from the App_Data folder. That was previously also part of the Properties page and has been moved to the new publish dialog for better accessibility.
Another new feature in this release is the ability to add web.config transforms on a per publish profile basis. You can do this by first creating your publish profile. Then right click on it in solution explorer and select Add Config Tranform.
You will then see a Web.<publish profile name>.config file created just for that publish profile. When you right click on that web.config file, you can also preview the changes that the transform would make with a side by side diff of the original web.config and a tranformed one :
Finally, this publish update includes a preview of a new feature that will let you selectively publish your files. This is a feature we are still working on and will officially release in the future, but if you would like to try it out, here’s how. First, add the following registry key: HKCUSoftwareMicrosoftVisualStudio11.0WebProjectsEnableSelectivePublish=1 or if you are using the Express sku HKCUSoftwareMicrosoftVWDExpress11.0WebProjectsEnableSelectivePublish=1. Restart VS if you had it open, and create a publish profile if you don’t already have one. Now when you right click on a file, you will see additional options to publish, compare or update the selected file:
When you click Publish <filename>, it will publish the file(s) you have selected using your currently active publish profile. There are no prompts or dialogs. It will just send that file to the remote server specified in your publish profile. The Compare command will do a diff of the local version of your selected file with the version on your remote server. And lastly the Update local file command will pull down the remote version of the file and replace your local version. These commands are meant as a convenient way to deploy small changes that you make to one or a few files without having to go through the publish dialog. We hope you find it useful and are eager to hear any feedback you have on the feature.