title: How to reference the same CodeBehind class from multiple .aspx files (and be able to pre-compile the website)?
body: <p>I have a set of aspx pages that each live in their own directory and reference a single aspx.cs code behind file.</p>
  
  <p>This has worked fine previously because I never tried to pre-compile the site. IIS must have individually compiled each aspx, linking them to the contents of App_Code but never referencing more than one aspx at a time.</p>
  
  <p>Now that I'm trying to pre-compile the website using Web Deployment Projects I keep getting errors about the same class being found in multiple assemblies.</p>
  
  <p>I can't just drop the aspx.cs in App_Code and subclass it because it wouldn't be able to find the controls on the .aspx pages when compiling. Maybe I could explicitly define every control on the page in the .cs? But would that allow them to be wired up correctly?</p>
  
  <p>Any other ideas on how I can reference the same Page class from multiple .aspx pages and be able to pre-compile the entire website?</p>
  
  <p><strong>Edit:</strong>
  It looks like CodeFileBaseClass may be what I want. I'll drop my .cs in App_Code, explicitly define all my pages controls, then specify this classs as CodeFileBaseClass in the aspx files that inherit from it. Thoughts?</p>
  
  <p><strong>Edit2:</strong>
  I came up with a solution, but since I can't yet mark it as accepted, I'd still like to see if anyone else could come up with some other solutions for this problem.</p>