Sooner or later, your .NET web application project will gather helping hands and it is at that point that you will realize that deployment from Visual Studio is just not good enough. Yes, I know Microsoft did a grand job with their deployment scheme in Visual Studio, but let’s be honest. That only works if you are a single developer working on a single environment. As soon as you have to do regular integration, testing and production deployment, Visual Studio fails. More hands on a project only makes things worse. This is not a critique. Visual Studio is development tool, not a continuous integration tool.

So, to positively answer Joel’s second question, you will need some sort of build and deployment automation. Sure, you can use TFS, but that costs money and a supercomputer and let’s be frank, most small shops cannot afford it. So, what you will end up is either some open source CI tool like *cough*CruiseControl.Net*cough* or write your own scripts. Whatever you use, you will find yourself in a peril building and deploying .NET web application. Why? To publish .NET web application building it and copying it to server just won’t work. The easiest way to do it is to create a package and deploy it to your IIS using MSDeploy extension. So, how do you go about that?

To create a package execute following command line expression:

Obviously this is for 64-bit systems using .NET 4.0 and 4.5.x. You can package your app for 32-bit systems using same expression by just removing 64 from Framework64 part of MSBuild.exe path.

Now that you have your deployment project ready, check MyWebApplication.SetParameters.xml file located at D:\path_to_my_project\bin\ folder and change IIS web site and name, if needed. Also, connection strings used are in that file, so you need to pay attention, if everything is set accordingly. Finally, you are ready to deploy:

There are ways to run deploy command file with another user, but that will take some server tweaking on your side. Anyway, after the command completes, you have a running application.