views:

2779

answers:

7

Hi,

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?

A: 

So it seems that MasterPages are causing more problems with ASP.NET 2.0. I'be had problems with them before, and now seems to be the same.

I created a new page, without MasterPage and it worked fine. The MasterPage is literally used for styling only. Shame.

Program.X
+3  A: 

I ran into your post when I ran into the same problem. There are probably a million solutions to a Circular reference problem, but mine was a direct result of Master Pages.

I accidentally created a page using a nested masterpage, outside the nested folder. Example:

Master1.Master
Page.aspx
(Folder1) 
Master2.Master

While Page.aspx was referencing Master2.Master as its masterpage, It would build normally, and error when I "Publish".

Hopefully that will help someone out.

-JBickford

JBickford
+1  A: 

For me it was registering the aspx page on the master page as well.

For example (in the master page): <%@ Register Assembly="MyPage" Namespace="MyPage" TagPrefix="MyPage" %> . . .

And then in the aspx page: <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MyPage.aspx.cs" Inherits="MyPage" Title="Untitled Page" %>

Removing the Register fixed it.

Kerrits
+1  A: 

I also ran into this problem, was able to get a successful Publish from within Visual Studio by selectin the "Use fixed naming and single page assemblies." For some reason that seems to avoid the compilier thinking there is a circular reference.

Greg S
+1  A: 

I expericence this behavior if I have a user control (ASCX) that is included inside a master page.

Usually I simply ignore the error since it is gone after the second build.

Uwe Keim
I had the same problem. Now I use a <asp:PlaceHolder> in my Master Page and in the code behind add the control programatically: phGoogleAnalyticsPageTracker.Controls.Add(Page.LoadControl(virtualPathToGoogleAnalyticsPageTrackerControl));
mathijsuitmegen
A: 

This bug still exists in ASP.NET 4.0.

The error I got was:

/DirA/PageA.aspx(3): error ASPPARSE: Circular file references are not allowed.
/DirA/PageA.aspx(71): error ASPPARSE: Unknown server tag 'Controls:ControlA'.

ControlA was the same control as referenced on PageA.aspx(3). I found that I had to move ControlA into the same directory as PageA in order to make this error stop.

A: 

Had the same problem...

/AdServer/Serve.ascx

Loaded by

/MasterPage/Master.Master which loaded /MasterPage/Controls/AdPlacement.ascx

Then, any management pages

/AdServer/Manage.aspx

which inherited from the /MasterPage/Master.Master

Circular reference. Which lo and behold, the error message was right.

I put all of the management pages in a separate folder, called /AdManager and circular reference gone.

Code Hard!

aaron