Compiling multiple pages to a single code-behind page in VS2005

  • Thread starter Thread starter LiveCycle
  • Start date Start date
L

LiveCycle

Hi,

I'm putting together a project that uses ASP.NET in VS2005. It uses a
single master page that is responsible for most of the heavy lifting. About
90% of the 200 pages have the same code-behind, so I implemented all of
these pages so they would reference the same code-behind cs file, as
follows:
<%@ Page Language="C#" MasterPageFile="~/MyMaster.master"
AutoEventWireup="true" CodeFile="~/Template.aspx.cs" Inherits="Template"
Title="Page Title" %>

The problem is, though, that the project is taking forever to compile, and
there are only about four lines of code in the Template.aspx.cs file, which
I was hoping would only compile once for that single page. When I publish
the project, it creates a DLL file for each page, regardless of whether I
check the Use fixed naming and single page assemblies checkbox.

So, is there any way that I can force the compiler to compile the
Template.aspx.cs class only once and have it apply to all pages that Inherit
that page?

Thanks, Jim
 
The compile times are due to each page having to reocmpile the common bits
and causing a compilation war. There is no reason to do this.

Options
1. Move common code into a class and call from each page - this does not
really solve the problem, but does provide for reuse of functionality
outside the website.
2. make a class that inherits from page and set pages to inherit from it
instead of page - best option if the code is really the same. Compiles once

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*************************************************
Think outside the box!
*************************************************
 
Back
Top