2011年9月22日 星期四

CodeFile 與 CodeBehind 的差別

ASP.NET 2.0之後應用CodeFile 來指定程式碼

用CodeFile指定會動態編譯(ie. 無須發行網站)

用CodeBehind 需要已編譯好的cs檔
---
*.net1.1->.net2.0轉換

*closed CodeBehind versus CodeFile

Description

I noticed recently that the N2CMS project uses CodeBehind="..." (asp.net version 1) to reference codebehind files instead of CodeFile="..." (asp.net version 2+). This makes it impossible to pass the web project validation in visual studio 2008 since the codebehind partial classes can't see the parts on the forms unless the parts are re-declared as protected variables in code-behind (which they aren't always and does not always work). The easy way to fix this is to search and replace CodeBehind for CodeFile across the project and then fix the duplicate variables and inaccessible classes. This isn't a critical issue but I thought that I'd throw it out there in case somebody was having the same problem as me. I could submit a patch if desired later this week / next week.

沒有留言:

張貼留言