<compilation batch=”false”>

Date March 29, 2007 @ 5:10 pm in Microsoft.Net 2.0

Today some of the C# / ASP.NET 2.0 code I created generated the following error “Circular file references are not allowed”.

After quite a bit of investigation, I realized that this was the result of how I had User Control’s organized within my website. For no good reason I was separating many of my user controls into sub directories within a parent “Controls” directory.

C:\….
+—Controls
+—– Admin
+—– Resources

By default, the compiler will batch assemblies (usually one per folder). This resulted in all files in the “Admin” folders being built into single assembly, while all files in the “Controls” folder where built into another.

In my situation I had a control in the root (Controls) referencing a control in “Admin”, while another control in “Admin” referenced one in “Controls”.

To temporarily get past the compiler issue one can set the batch attribute in the compilation element of the webconfig equal to false. This tells the ASP.NET compiler to not batch assemblies, and instead create an assembly for each user control. Now obviously this is not a good idea in production, but is a great way to get past the error in testing.

The long term solution is to remove the additional sub directories or better organize them.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">