What's hot ? (and I mean really ...) - scroll down for more
1).  Code Templating - advanced usage of delegates & generics: my slides & demos are available for download! CodeProject article is also available.

2).  My series "TDD in the eyes of a simpleminded" is in progress(including code!): preface, part1, part2, Q&A 1, Manual Stub .vs. Mock Stub

3).  TDD Workshop: SeeCompass v0.1 and v0.2 are out.
# Friday, May 19, 2006

In the new asp.net 2.0 web application model, every web page (.aspx) and it's code behind (the class that this page "Inherits" from, actually it's partial with it, but that's the property name) compiles into a single assembly. At least as a default behavior.

aspnet2_Compile_flow.gif

 

That means that the following relationship is completely valid in this compilation model:

Default.aspx (CodeFile=Default.aspx.cs, Inherits=MyNamesapce.MyDefaultPage)
   Default.aspx.cs (class name MyNamespace.MyDefaultPage)

Default2.aspx (CodeFile=Default2.aspx.cs, Inherits=MyNamesapce.MyDefaultPage) // Inherits: same as above
   Default2.aspx.cs (class name MyNamespace.MyDefaultPage// class name: same as above


This can be quite confusing though. While you're developing everything will work as expected as every .aspx & aspx.cs will compile to a different assembly so no collision will occur; So you think you're good to go...

The problems start to show up when you're trying to compile everything to a single assembly (production env.). Now you'll get an "aspnet_merge.exe" error which tells you that you can't combine (1) Default.aspx with (2) Default2.aspx and (3) MyNamespace.MyDefaultPage class. It makes sense, after all, those three are partial classes.

When can this happen ?

if you Copy-Paste an existing page & forget to change the name of the class in the CodeBehind and in the Inherits property.

Solution - How to check if you're really good to go:

I've written a small utility with Mario, my teammate, which will find this duplication and give you a little report telling ya if you have more than 1 aspx file which inherit from the same class. Running it on the example above will produce the following report:

aspnet2_inspector_util.gif

Now all I have to do is change the Default.aspx.cs class name and change the Inherits property name in Default.aspx.

How to use the "Duplication Inspector" utility ?

(1) Extract the zip file (down below).
(2) Open app.config and change the "WebDirectoryToInspect" as needed.
(3) Run the InheritsDuplicationInspector.exe and voila !

You can find the source files here:

InheritsDuplicationInspector.zip - 47 KB

Have fun.

Sunday, July 29, 2007 6:00:09 PM (Jerusalem Standard Time, UTC+02:00)

<a href="http://friendlyfighettasesso.nbfo.com.ar">friendly fighetta sesso</a>
<a href="http://sborra-e-seghe-.silverdragon.pl">sborra e seghe</a>
<a href="http://accompagnatrici-gratis-.sjz1963.pl">accompagnatrici gratis</a>
<a href="http://screensavernatalizigrati.ginpol.pl">screensaver natalizi gratis</a>
<a href="http://dvddidragonballdascarica.nbfo.com.ar">dvd di dragon ball da scaricare</a>
<a href="http://fotodehombresgay.nbfo.com.ar">foto de hombres gay</a>
<a href="http://lecca-la-fica-.sjz1963.pl">lecca la fica</a>
<a href="http://tuttigliuominidelpreside.nbfo.com.ar">tutti gli uomini del presidente</a>
<a href="http://italian-sex-link-.silverdragon.pl">italian sex link</a>
<a href="http://tetteefigheslabbrate.nbfo.com.ar">tette e fighe slabbrate</a>
<a href="http://blackcocks.nbfo.com.ar">black cocks</a>
<a href="http://lula3dinglesecomeconvert.ginpol.pl">lula 3d inglese come convertito in italiano</a>
<a href="http://ragazze-grasse-tettone-.silverdragon.pl">ragazze grasse tettone</a>
<a href="http://rossesexytette.ginpol.pl">rosse sexy tette</a>
ewrw
Comments are closed.