Visual Studio 2010 1-Click Publishing

When it comes to deploying websites, many developers and companies have unique and creative ways to handle deployment.  While some have fully workable solutions, I believe that there is a lot of room for growth to bring powerful and straight forward publishing tools to the masses and to support mature publishing methods for simple and complex sites alike. 

Visual Studio 2010 introduces 1-Click Publishing which, along with Web Deploy, makes some nice strides in this area.

VS 2010 supports 4 methods of publishing content.  They are: MSDeploy Publish, FTP, File System, FPSE.  Let’s talk briefly about each:

MSDeploy Publish: this is the subject of this blog post and will be covered in more depth below.  At it’s core, MSDeploy, aka Web Deployment Tool, is a command line tool used for deploying websites and settings.  It can deploy or migrate website content, website settings, ACLs, COM, GAC and registry settings.  As you can assume, the administrator on the target machine can specify which settings are allowed to be pushed.  This is the foundation of many impressive deployment tools that we should expect to see coming out of Microsoft in the coming months and years.  Visual Studio takes away the command line complexity of MSDeploy and provides the ability to deploy with a single click.

FTP: File Transfer Protocol has been around since the early days of the internet but has always had one major shortcoming—security.  There are ways to make it security using SFTP (SSH FTP), FTPS (FTP over TLS/SSL) and some other methods, but the FTP protocol at its core is a plain text protocol, including the authentication (username/password).  Recently we’ve seen a lot of progress for FTPS within Microsoft so that servers and tools support it, so be sure to use a secure method of FTP whenever possible.

File System: If you are on the same network or using a VPN connection to the destination web server then you can use the File System method of publishing.  This uses straight xcopy to push the content directly to the destination location.

FPSE: FrontPage Server Extensions.  FPSE has 2 aspects.  One is the extensions part which were introduced with the Internet was fairly young, to support things like hit counters, email components and other bots.  Some developers that develop with FrontPage use these.  The other aspect of FPSE is publishing.  FPSE offers a secure method of publishing content to a web server.  However, FPSE has been plagued with security and difficult configuration issues over the years and, to my relief, I believe it’s on the way out.  However, VS 2010 still offers support for pushing with FPSE, so if your destination servers supports FPSE, you do have this publishing technology available to you.

The remainder of this blog post is a simple walkthrough on publishing using MSDeploy, which can be done over HTTPS, providing much better security than plain text FTP.  The host or production servers need to support MSDeploy. 

Playground

ORCS Web has worked with Microsoft to provide a testing account so that you can try out MSDeploy completely free of charge.  This promotion is available for a few months starting in June 2009.  Vishal Joshi has formally announced this plan also. If you want to try out the publish feature covered here, but don’t want to setup and configure a production server, sign up for one of these accounts.

Publish Web Tool (using MSDeploy Publish)

You can access the Publish Web Tool either by the top menu: Build –> Publish {project name} or from the Publish menu:

image

Open the Publish Web tool to get started.

image

The tool should look like this, but the fields will change with the different Publish Methods.  We’ll just cover MSDeploy Publish here.

If you don’t have the information from your host or server admin team, make sure to obtain that now.  I’ll cover the fields and what they mean here:

Profile Name: (at the top) This is the friendly name that you provide to reference your deployment profile.  Visual Studio 2010 supports up to 50 profiles.

Publish Method: These are the 4 methods mentioned above: MSDeploy Publish, FTP, File System and FPSE. 

Service URL: This is the MSDeploy URL that your administrator or host provides.  It will be something like https://ServerNameOrIP:8172/MsDeploy.axd

Site/Application: This is the IIS site name, but it’s more than that.  Within this field you can specify a sub folder(s) where your project will be deployed.  Your host or administrator will likely provide the root path that you have access to, for example SiteName or SiteName/vdir.  But you can optionally be more specific in the path, like so: SiteName/ProjectName.  The root Site/Application name must be exactly the name of  the destination IIS Site (plus optionally the application).

Mark as IIS application on destination: If you set a sub folder for the “Site/Application” field and check this checkbox, it will mark the folder as an application root when publishing.  Your host/administrator must support this on the destination server.

Do not delete extra files on destination:  If this is unchecked it will first delete everything from the destination folder before publishing the new content.  You will likely only want this unchecked for the initial deployment and then have it checked every time after that, until you want to start fresh.

Allow Untrusted Certificate:  The certificate that your host/administrator uses may be a self-signed certificate or it may be for a different name than the URL.  Only check this if your host or administrator instructs.

User Name and Password:  This is the username and password used to connect to IIS, likely provided by your host/administrator. 

Save password:  This goes without saying.  It’s up to you whether you have Visual Studio save your password or not. 

Once you’ve filled out the fields, you can Publish immediately or Save so that you can publish later.

If all is setup correctly, you can publish by clicking the Publish button, or from the 1-Click Publish button.  The 1-Click Publish feature is literally that: after setup, when you make a change that you want to publish to the web, just click that one icon and it will take care of the deployment.

image

In my opinion, the most impressive feature of MSDeploy is that it only publishes the changes between the source and destination location.  If you have a 2GB site but only changed 2 files, when you click Publish, it will deploy only the changes, very rapidly.  Additionally, from a network and server utilization perspective, MSDeploy is much faster and efficient than IIS FTP.

Shortcoming – error reporting

The biggest shortcoming that I find is regarding the error reporting when something goes wrong.  VS 2010 doesn’t expose to you very much information about the errors.  Most error information is available to the host administrator on the destination server.  If you receive an error that isn’t clear, double check each of the fields.  The most common failure is related simply to incorrect information. 

There’s more, but not here and now.

Visual Studio’s Publish feature has a lot more.  The two other most significant features are the Database Publishing and MSDeploy’s Transform feature so that your web.config settings can be changed as they are published.

I’m not going to cover them here and no though, but I’ll provide some useful links below which cover all of these features in more detail.

Links.

The best walkthroughs and information on MSDeploy and Visual Studio’s 1-Click Publish feature likely comes from Vishal Joshi.  He’s a program Manager with Microsoft for these technologies and is an authoritative source of information.  Start with this blog post: Web 1-Click Publish with VS 2010

Keep an eye open for more publishing tools and progress in the future.  I believe we’re just at the beginning of great things to come.

5 Comments

  • This is no help at all, and the walkthrough link is dead.

  • Thanks for mentioning Dave. This is an old article. Hopefully there are better and more current ones out there. I removed the references to the dead links.

  • Is there a way to increase the number of profiles? I have hit 50 and I need to above that. I work in a school system and I created an application that sits on each school's Lansweeper server. We have 65 schools. Any help would be appreciated.

  • Hi Bob,

    Good question. I was able to find out some information from the VS dev's. That limit will be removed in the next version of Visual Studio, so in the future it will be a non-issue.

    For now, here's the solution that they provided:

    "He can rename away the existing publish.xml file and VS will create a new one to contain the rest 50~65. When he wants to publish all, he can always rename the first one back and VS will just pick up. If he is using SP1, he doesn’t need to reload the project."

  • I was able to find out some information from the VS dev's. That limit will be removed in the next version of Visual Studio, so in the future it will be a non-issue.

Comments have been disabled for this content.