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

Please review this very important KB article: How to Prevent website permissions (ACL) from being changed during a Publish

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: (or whatever your web publish settings tell you)
Mark as IIS application: un-checked
Leave extra files on destination: Checked (don’t delete your web.config, see below)
Allow untrusted cert.: Checked
User name: yourdomain.com_dploy

To get your user name and password, please see:

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:

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