Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Circular file references not allowed

Tags:

I am having a problem in building my solution in VS2008. Normally, it compiles fine in the environment. Sometimes, it fails with:

/xxx_WEB/secure/CMSManagedTargetPage.aspx(1): error ASPPARSE: Circular file references are not allowed. 

I rebuild and it works fine.

Now, however, I am in the middle of setting up a CruiseControl.NET system and am testing my checked out code with MSBuild before I integrate the build into CC. Now, everytime I MSBuild, I get:

"Q:\cc\xxx\checked out from svn\xxx.sln" (default target) (1) -> (xxx_WEB target) ->   /xxx_WEB/secure/CMSManagedTargetPage.aspx(1): error ASPPARSE: Circular file references are not allowed. 

Problem is, I can't see where this reference is.

  • I have searched for the reference across the entire solution and canf ind no references to the page itself (CMSManagedTargetPage) anywhere other than in the page or its codebehind, or within a string, eg:

    C:\dev2008\xxx\IWW.xxx.ASPNET\AspxHttpHandler.cs(82): inputFile = context.Server.MapPath("~/secure/CMSManagedTargetPage.aspx"); C:\dev2008\xxx\IWW.xxx.ASPNET\AspxHttpHandler.cs(83): virtualPath = "~/secure/CMSManagedTargetPage.aspx";

My assembly references are also fine (as far as I know). My Web Application is at the "top" of the dependencies, and nothing references it and therefore the faulting page so cannot cause a circular reference. Of course, the page itself may reference something such as a UserControl within the same assembly/web site, but as mentioned earlier, a search on CMSManagedTargetPage yielded no results so this is not happening.

Changing the batch attribute in web.config had no effect on MSBuild.

I find it very odd that it "sometimes" fails in VS and always fails in MSBuild. Am I missing some subtlety?

like image 485
Program.X Avatar asked Apr 08 '09 09:04

Program.X


People also ask

What is a circular object reference?

A circular reference occurs when one heap variable contains a reference to a second heap variable, and the second one contains a reference back to the first. For instance, if A is an object, and somewhere in A, there is a reference to B, and within B is a reference back to A, there is a circular reference.

What is circular reference exception C#?

Circular reference occurs when two or more interdependent resources cause lock condition. This makes the resource unusable. To handle the problem of circular references in C#, you should use garbage collection.


1 Answers

Reposted from:

http://ellisweb.net/2009/12/fixing-the-circular-file-references-are-not-allowed-error-in-asp-net/

If you have the following setup: /folder1/Control1.ascx > References Control2 /folder2/Control2.ascx > References Control3 /folder1/Control3.ascx This means that the folder1 dll will reference the folder2 dll which will again reference the folder1 dll, causing a “circular file reference”.


This helped me out today; I had a master page in the root referencing a master page in a folder, which referenced a different page in the root. Shuffling which pages were in which folders worked like a charm.

like image 130
Joisey Mike Avatar answered Sep 28 '22 23:09

Joisey Mike