If you want more interoperability between 1.1 and 2.O, use the Web
Application Project model instead of the original WebSite model in ASP.NET
2.0.
99% of 1.1 code WILL compile just fine in .NET 2.0.
Peter
--
Site:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
Short urls & more:
http://ittyurl.net
"(E-Mail Removed)" wrote:
> Has anyone successfully managed to work out how to get ASP pages to
> compile under both 1.1 and 2.0? Basically I'm in the final stages
> before deploying a version of an application that will be using 1.1,
> and still making occasional fixes, but I'm also trying to move over
> to .NET 2.0 for the next version. The biggest problem I've hit is the
> new compilation models. From what I've read, .NET 2.0 is supposed be
> able to support the old "codebehind" compilation model for .NET 1.1
> that doesn't require partial classes etc., but the only way I've been
> able to get it to work is to change the .aspx @page directive to use
> "Src=" instead of "CodeBehind=". Without this I get a "Could not load
> type 'xxx'" error for every page using Codebehind. But doing this
> causes it fail with strange runtime errors under .NET 1.1 (mainly to
> do with types being defined in multiple places).
> The other alternative was use wrap the "partial" keyword, plus the
> page control variable definitions not needed under .NET 2.0 in an #if,
> and have both the "Codebehind" AND "Codefile" directives in the ASPX
> pages - .NET 2.0 appears to ignore the former, and .NET 1.1 the
> latter, so I believe this will actually work, but I'm not 100%
> confident by any means, and it sure looks ugly having code like:
>
> public
> #if NET20
> partial
> #endif
> class MyPage : System.Web.UI.Page
> {
> #if !NET20
> public TextBox TextBox1;
> public TextBox TextBox2;
> #endif
> }
>
> all over the place!
>
> Then there's the issue of code that needs to be in the App_Code
> directory...although I can deal with that via the Source Control
> system relatively easily.
>
> I expect to be fixing bugs in the 1.1 version for at least a few weeks
> yet, and having to continally manually apply them to the 2.0 version
> seems theoretically more painful than trying to stick with a single
> code version (note that I'm not planning on making functionality
> changes to the 2.0 version for a while, otherwise obviously I would
> need two code branches), but I suspect that MS haven't exactly made
> this easy to achieve, for whatever reason.
>
>