User Tools

Site Tools


precompile_and_publish_asp_net_web_applications.htm
Navigation:  Clarion.Net (Clarion#) > Clarion.NET FAQs/Troubleshooting > WebForms >====== Precompile and Publish ASP.NET Web Applications ====== Previous pageReturn to chapter overviewNext page

The IDE supports precompiling and publishing a web application. By default, ASP.NET dynamically parses and compiles any ASPX page when the first request is made for the page. The .NET runtime caches the compilation outputs and does not need to recompile again unless someone edits a file. This behavior brings us a good amount of flexibility, including the flexibility to change code and markup. and instantly see the changes reflected in the next browser request. ASP.NET 2.0 introduced the option of precompiling your website. Precompiling offers the following advantages :

You do not need to deploy the source code to the server. The website is precompiled into binaries, which are then deployed to the server.

This allows you to identify any bugs during compilation rather then opening each page and discovering it at that time.

This deployment process is easier, as all of your ASPX pages, user controls etc. are compiled into binaries. There are two ways that you can precompile a website.

Precompiling Web Sites at the Command Line

When you have an ASP.Net project open, the IDE “Build” command validates the project and puts the assemblies into the ASP.NET temporary folder.

The values you enter on the new MSBuild tab of the Project Properties are valid if you want to build the project from the command line.

At a command prompt, use the following syntax:

MSBuild <;projectfile>.aspxproj /target:Msbuild /property:ClaNetBinPath=<;Clarion.Net BIN folder>

Precompile and Publish Web Sites using the Clarion IDE

To precompile and publish your website using the IDE, follow these steps:

1. Open your website project

2. In the Solution Explorer right-click on the Project and from the context menu choose “Publish Web Site”

PublishWebSite.jpg

3. You then get a Publish Web Site dialog like shown below where you can specify the path to publish. Clicking on the ellipsis(') lets you select a folder.

4. Select your options in the dialog :

Allow this precompiled site to be updatable

This option allows you to change the markup and client side functionality of the .ASPX pages.

Use Fixed Naming And Single Page Assemblies

Compile single assemblies that correspond to a single page or user control (that is to .ASPX, .ASCX, and .MASTER files). The fixed file-name option also preserves the names of your assemblies when you compile and publish your Web site. When you use fixed file names with single-page assemblies, batch compilation is turned off for precompilation. (Themes and skin files, along with other folders that do not contain pages or user controls, will continue to be compiled to a single assembly.)

When you choose to generate fixed assembly names, ASP.NET will do the following:

·Create an assembly for each .ASPX, .ASCX, and .MASTER file in the application. You should limit the number pages in your application to reduce the number of assemblies that are generated.

·Use the virtual path to the page as the name of the page's assembly. If the length of the virtual path exceeds the file-name length limit of the operating system, the tool uses a hash of the virtual path instead.

·Compile the files in top-level directories, such as the App_Code directory, into a single assembly, as is done during batch compilation.

Enable strong naming on precompiled assemblies

Specifies that your assemblies are strong named using a key file or container.

5. Click OK to compile and publish the website.

precompile_and_publish_asp_net_web_applications.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1