views:

229

answers:

1

Hi,

Can I somehow utilize the App_code folder in a web application project to compile code on the fly? It'd be great for plugins. Recently Rob Conery demonstrated its use in his talk at MIX 09 in a ASP.NET MVC app. I tried to do the same in a web app but I can't access the classes under App_Code from anywhere else. But if Rob was able to do it in an MVC app, it should be doable in a web application too. After all ASP.NET MVC IS a ASP.NET Web Application under the covers.

+1  A: 

If you add a code file to the App_Code folder, it should be compiled and available from a code-behind file for a control, or another code file in the App_Code file.

I don't think you'll be able to access it directly from a compiled assembly, since the compiler won't be able to find that reference at compile time.

You'll also need to be aware that App_Code is compiled into a different assembly than your code-behind code, so you can't access internal code across the different assemblies.

bdukes