How to Use Visual Studio 10 Web Deploy to Publish Your Application?

I like to use Web Deploy because it is quick and easy if I am making multiple changes in development and testing. For example, I might want to test the speed of a page on my hosting server, something I can’t test by running it on my local machine. Web Deploy allows me to change a line of code, deploy it quickly, and test it.

So, how to do it? I spent quite a lot of time aimlessly trying options, but got it right in the end. Here’s what works for me.

First off, go to project properties, Package / Publish Web tab.

Choose “Only files needed to run this application”. If you don’t, your source code will be copied to the hosting server.
Before you go any further, take a backup of your web.config on your hosting server if it is different to your development file. It will be over-written by your development file in the Publish process (more on how to prevent this below).

Next, go Menu -> Build -> Publish MyProject (I use a keyboard shortcut: Ctrl Alt F9)
You’ll see the Publish Web dialogue box

Publish Method:                                        Web Deploy
Service URL:                                               winweb01.hkdns.co.za (or your appropriate Hostking server)
Site/application:                                       MyWebSite.com
Mark as IIS application:                         Unticked
Leave extra files on destination:         Ticked (don’t delete your web.config, see below)
Allow untrusted cert.                               Ticked
User name:                                                   MyWebSite.com_admin (see below)
Password:

To get your user name and password, go to the Hostking Control Panel, Management tab in Web Site Properties
There you will see the username, and can set your password.

How to prevent your hosting server  web.config being over-written in the Publish process:

  1. Publish Web option “Leave extra files on destination (do not delete)”:      Ticked (see above)
  2. Look in directory C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications

Find the file Microsoft.WebApplication.targets

Edit it (admin rights needed, and of course copy a backup)
Find the line
<Import Project=”..\Web\Microsoft.Web.Publishing.targets” Condition=”Exists(‘..\Web\Microsoft.Web.Publishing.targets’)” />

After this line add these lines:

<ItemGroup>
<ExcludeFromPackageFiles Include=”web.config”>
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>

 

 
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to do a Tracert?

This tutorial will show you how to run a trace route on a Window operating system. If you are...

How to do a TELNET on a PC (Windows) OS?

From time to time you may need to perform an operation called "TELNET".You can use TELNET to...

How to do a Ping?

The purpose of this tutorial is to teach you how to do a ping. Pinging is a command which tells...

How to Clear Your Cache in Internet Explorer?

This tutorial will assist you with clearing your cache, which will help your computer run...

How to change the default index page using a .htaccess file?

The below command will set the default page your website shows to whatever you specify. For...