How to Use Visual Studio 10 Web Deploy to Publish Your Application
Written by Bryce Abbott Tuesday, 8 February 2011
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).
Publish Method: Web Deploy
Service URL: HAZEL.arvixe.com (or your appropriate Arvixe server)
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)
To get your user name and password, go to the Arvixe 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:
- Publish Web option “Leave extra files on destination (do not delete)”: Ticked (see above)
- 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:
Works for me. Comments and suggestions welcome.