Precompiling a Web Site


Instead of copying all files to the target Website, you can precompile the Website. With precompiling, the assemblies are created before the files are copied to the target Website. This way, source files are not copied to the target Website.

In the next Try It Out, you publish the Web application from Chapter 19 using Visual Studio.

Try It Out – Precompiling a Website for Deployment

image from book
  1. Open the Web application from Chapter 19 with Visual Studio.

  2. Start the Visual Studio 2005 command prompt.

  3. Create a new directory for the precompiled Website, e.g., c:/precompiledWeb.

  4. In the Visual Studio command prompt enter this command:

    aspnet_compiler –p c:/BegVCSharp/WebProgramming/EventRegistrationWeb    –v / c:/precompiledWeb

    The option –p references the physical path of the source files from the Website that should be precompiled. The option –v / specifies how root references within the Web pages should be resolved. The last option c:/precompiledWeb specifies the target path where the precompiled files should be stored.

  5. After the publishing is completed, check the created files on the target site. You will find ASXP files, but when you check the content of these files, you'll find only this text:

     This is a marker file generated by the precompilation tool, and should not be deleted! 

    You can find the generated assemblies in the bin directory. the bin directory contains XML files (with the extension .compiled) that map the ASPX files to assemblies. Each Web page will have one assembly with the file extension .dll.

    Important

    Precompiling Websites has the advantage that the source files are not copied to the target Website, which means that the Web administrator cannot change the source files on the server.

image from book




Beginning Visual C# 2005
Beginning Visual C#supAND#174;/sup 2005
ISBN: B000N7ETVG
EAN: N/A
Year: 2005
Pages: 278

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net