Understanding Publish Feature in Visual Studio 2005 for Web Application Projects

Visual Studio 2005 has features that can used to publish a website in a production server or a staging server. The copy web site tool and the publish web site utility are the two tools that are available for this purpose. Using these tools are very easy than it was done in the earlier versions of the software.



Earlier you had to build the website in to an assembly and then deploy it in the production server with the entire necessary .aspx file, config files, assembly file and other files that are necessary for proper running of the website. When you do this you should have the target server in the network. You would have also created .msi file for creating installation of the website.

In the latest version of the Visual Studio there is a tool called the Copy Web Site tool. With this tool you can just copy the entire web site to the target server. You can also use the Publish Web Site utility for publishing your website. This utility compiles your web site into executable files.

After this the executable files are copied to the production server or the staging server using any method that you like. Visual Web Developer Express Edition does not have this Publish Web Site utility. If you are using these tools for publishing your website there is no need to configure your production server for FrontPage Server Extensions.

The conventional method is to create a website and then deploy it in the production server. It is also possible to create a FTP (File Transfer Protocol) Web Site so that you can access the hosted server directly and edit the files in it. In this method you can directly work with the files in the hosted server. This method is very fast and easy to work on the web site. More information on this method is available in the MSDN website.

The copy web site tool available in the Visual Studio 2005 can be easily compared to the FTP utility. With this utility you can open a directory in the production server and then upload the files necessary to that directory from the local website you have in your system. Earlier versions of Visual Studio used a Copy Project utility for this purpose. The copy web site tool in the latest version of Visual Studio has improved features than the Copy Project Utility.

Some of the improvements in this tool are that there is no need for compiling the files before you move them to the target server. All you have to do is to simply copy the .aspx and the class files. Any other source files necessary are also copied to the target server. The compilation takes place dynamically when the file is requested.

Any web site that is supported in Visual Studio can be opened or copied using the Copy Web Site tool. The production server in which the files of the website are copied need not have the FrontPage Extensions in it. Files supported by IIS, Remote IIS, and FTP can be opened using the copy web site tool.

Apart from copying files to the target server the Copy Web Site tool also checks the updates in the local server and then synchronizes the files in the local server with that of the production server. With this feature of the Copy Web Site tool the files on both the server are always up to date.

One another interesting feature of the Copy Web Site tool is that it places a file called App_Offline.htm to the target server’s root directory before it copies the files to the target server. So, when somebody accesses the website while the files are being copied the user is redirected to the App_Offline.htm which displays a friendly message that states that the website is being updated. After the files are copied the file App_Offline.htm is deleted by the Copy Web Site tool.

Walkthrough on how to use this utility is available in the MSDN website. You can use this to see how to use the Copy Web Site tool. .Net framework 2.0 should be available in the production server if you want the web site to behave as you expected. You can open and edit the files in the production server directly if the production server is an FTP Server. You can also administer the website using the ASP.Net Web Site Administration Tool available for this purpose.

Pre-compilation is done when you use the Publish Web Site utility that is available in the Visual Studio 2005. Only after compilation that files are copied to the production server in the directory of your choice. When the website is compiled using the Publish Web Site utility the source code is removed from the files and stub files are used. When a request comes to the page the precompiled assemblies are used.

There is a marked difference in the pre-compilation process in the Publish Web Site utility. In the earlier version the code files were only compiled. The code files were compiled into a single assembly. But in the Publish web site utility you can compile the markup in the .aspx optionally. With the Publish Web Site utility the standalone classes are compiled in to a separate class and the pages with code are compiled into individual assemblies.

When you compile files using the Publish Web Site utility the source code is removed. The marked up code in the .aspx files can also be removed optionally. After compilation the .aspx pages point to the compiled versions. With this feature the source code of your pages are safe. Accessing your code by others is difficult. This is one of the features that are more useful for those who want their code to be safe.

Pre-compilation in the Publish Web Site utility helps you in identifying the compile time errors earlier than in the earlier versions. With this the response is quicker than the earlier versions. This utility also compiles the Web.Config file. This helps in tracking the compile time errors that are present in the configuration file.

Check out the MSDN documentation for walkthrough of the features like this present in the latest version of Visual Studio 2005.

Related Article: 7 Reasons To Choose Visual Studio Code for .NET Development


“Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.”

| Privacy Policy for www.dotnet-guide.com | Disclosure | Contact |

Copyright - © 2004 - 2024 - All Rights Reserved.