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: https://ssl25.secure-svr.com:8172/MsDeploy.axd (or whatever your web publish settings tell you)
Site/application: yourdomain.com
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
Password:

To get your user name and password, please see:  http://support.webecs.com/KB/a871/how-to-enable-web-delpoy.aspx

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>




Add Feedback