Bagikan melalui


Building Web Sites

You can build (validate) the current page or your entire Web site at any time to help find compile-time errors. Building performs tasks, such as the following:

  • Compiles the code in all pages in the site.

  • Compiles the code in the App_Code folder.

  • Compiles code in the Global.asax file.

  • Resolves and, if necessary, compiles any dependent resources.

  • Parses the configuration file to look for invalid configuration elements.

In short, building a Web site performs the same compilation tasks that occur when a page is requested in the browser. However, the resulting object code is not used to run the page.

Building Individual Pages

You can also build individual pages. In that case, Visual Studio compiles only the current page and its dependencies. You might find this useful if your site contains many unfinished pages and you do not want to be notified of errors in any page but the one you are currently working with. You can set options for what to build by setting project options. For details, see How to: Test Web Pages in Visual Web Developer.

Building versus Precompiling

Building a page or Web site is part of developing a site, and is intended to help you find compile-time errors that might occur anywhere in the site. Although building does compile the pages, it does not produce an assembly that you deploy. You can deploy a site without compiling it by copying all of the files in the Web site to a production server. When users request pages from the production server, ASP.NET will dynamically compile the site, effectively performing the same steps that the build process does in Visual Studio. (ASP.NET caches the resulting output so that the pages do not need to be recompiled with each request.)

If you want to compile the site into assemblies and other files that you can deploy, you can publish the site. Publishing performs the same compilation steps that building does, but it saves the output into a folder and subfolders that you can in turn deploy to the production server.

For more information, see ASP.NET Deployment Overview.

See Also

Tasks

How to: Test Web Pages in Visual Web Developer

Concepts

Testing Web Pages in Visual Web Developer