views:

170

answers:

3

I have an ASP.NET website project which has a mixture of updateable pages and pages that do not change.

Is it possible for me to pre-compile certain directories that contain pages/controls that will not be updated?

If so, how could I designate these directories as such?

Edit 2009.12.17

My project is structured like this:

/cms_pages ==> Updateable .aspx pages marked CompilationMode="never" and no code file.

/app_pages ==> .aspx pages with .aspx.cs code file.

/controls ==> .ascx controls with .ascx.cs code file.

I would like to "pre-compile" the app_pages and controls folders.

Is it possible to do?

A: 

Not without a lot of headaches. How are you precompiling the pages now? They must be in a WAP for this to work... so anything you DON'T want precompiled just leave out of the project.

[Edit]

It's possible to manually call the asp.net compiler. But I don't recommend this. What you really need to do is split up your solution files into different projects... put the files you want pre-compiled into a Web Application Project or just a regular class library. Then in your Web Site add a project reference to this WAP.

Bryan
Currently, I'm not pre-compiling anything. I'm running a website project, not WAP.I have a folder /controls containing .ascx and corresponding .ascx.cs files. These are compiled, presumably, on their first access or after appdomain restart.
frankadelic
See my edit, above.
Bryan
A: 

Do you want to compile your ASPX pages with their codefiles or just compile some .cs files in your App_Code folder?

If you're just trying to version control some static functions or global objects you can compile a DLL to keep in your App_Code folder.

Justin C
A: 

Couldn't you just pre-compile all of the controls (and probably anything else) into an assembly then you can access them through myAssembly.myControl

 Dim assembly As Reflection.Assembly = Reflection.Assembly.LoadFrom(Server.MapPath(Virtual path to assembly))

Dim myControlType As Type = assembly.GetType Dim myControl As UserControl = LoadControl(myControlType, Nothing) myPanel.Controls.Add(myControl )

Or

Dim myControl As Control = LoadControl(virtual path to control)
myPanel.Controls.Add(myControl )

Hope this helps..

Markive