views:

80

answers:

1

I fired up my first asp.net 4 app put together with visual studio 2010 and IIS doesn't seem to compile my code behinds on the fly for some reason, I have to build the site manually.

How do I configure my app to compile code behinds on the fly? I looked around but I must be missing something. Never had this issue before.

Thanks all,

bd

A: 

There are now two web site types Web Application and Web site. The former must be pre-compiled, the latter can be compiled on the fly.

You create Web Application from File > New > Project... You create Web Site from File > New > Web site...

Philip Smith
Seems like there may be a way around this by changing the CodeBehind directive attribute to CodeFile.
BrooklynDev
There are many differences as detailed in this article http://www.codersbarn.com/post/2008/06/ASPNET-Web-Site-versus-Web-Application-Project.aspx I would suggest using one or the other. Trying to shoe horn one into another is likely going to end in tears.
Philip Smith
I can see how many developers would prefer the Web Application model over the Website model but for me dynamic compilation is just too convenient not to use. If I want to have proper namespacing and layered architecture I can, everything is just more convenient when your working on code that is is dynamically compiled. If it's shared it's shared, you've got to put that code in a referenced assembly. If it's only for that page or project and nothing else though, dynamic compilation can help you work faster.
BrooklynDev
Some of the continues integration features and different ways you can tie your project to an automated build process still allude me though, it's possible there's some cool build features web site projects can't take advantage of. For now though I'll stick with websites unless there's a specific compelling reason to do otherwise.
BrooklynDev