There are two ways of publishing websites in ASP.NET with Visual Studio:
- Using the Copy Web Site Tool from Visual Studio
- Using the Publish Web Site Tool from Visual Studio
Copy Web Site Tool:
Consider using the Copy Web Site Tool when you cannot open the remote site as Remote IIS Site, and need more power over it than a simple FTP Web Site. It supports synchronization which makes sure that all files in both sides are up to date.
When using the Copy Web Site Tool, essentially you are working with two web sites at the same time. The source site, which is the site opened in Visual Studio, and the remote site, where you want to copy the content of the source site. With synchronization enabled, you can choose between the versions of the files you want to hold, or discard. It also enables multiple developers to work on the same site in the same time.
The DOS command line tool named XCOPY has the same advantages as the Copy Web Site Tool, and it doesn’t require Visual Studio to be installed on your computer.
Publish Web Site Tool:
The Publish Web Site Tool is an entirely different approach than the Copy Web Site Tool. With Publish Web Site, you can precompile a web page, so that the first user’s first requests won’t be delayed by the dynamic compilation of the pages. It also helps you protect your code, since it is able to merge all your source code files into a single assembly. A great advantage is it also checks for errors in your application, which would otherwise be discovered by an unnoticing user.
There are a couple of publish settings in Visual Studio. For example, by checking the Allow this precompiled site to be updatable box, you will be able to update the layout of the .aspx files later (but not the code). Check the Enable strong naming on precompiled assemblies box to name strongly named assemblies using a key file, etc.
If you don’t have Visual Studio installed, you can use the aspnet_compiler tool for the same effect on your web application.