Circular File References not allowed with Master Pages

Circular File References not allowed with Master Pages

As part of a large rebranding effort, my team and I recently added a series of master pages to our project, each encapsulating a different module of a large portal. Each master page was nested inside a parent master page that handled authentication, the main menu and other elements that are shared with all pages of the site.

To help keep everything neat and organized, we created a MasterPage folder to hold all of our master pages.

Master Page Reference in Page Directive

Nested Master Pages in Folder

Everything compiled correctly and tested well on our local machines, but when we kicked off out Team Foundation Server builds, we started seeing a series of errors for each master page "Circular file references are not allowed."

Circular file references are not allowed in Team Foundation Server

I explored each module's master page, the parent master page, and child pages within the site to find nothing that resembled a circular reference. After some heavy browsing, I found that most people with similar errors had issues with user controls in folders. While my issues wasn't quite the same, I thought it might be worth a shot to take my master pages out of my neat and tidy MasterPage folder and instead house them in the root along with my parent MasterPage.

Relocating each of the master pages did fix my problem. I assume the issue comes about during the build process if the system attempts to build a page that references my master page before it gets to my master page, but I'm not 100% sure that's what's going on here. Regardless, hopefully this will help others with the same issue get a successful build.

The final step after moving my masterpages to the root directory was to do a simple Find/Replace for each masterpage to remove the folder name from the Page Directive.

Find and Replace all Master Page Files

Find this helpful? Share it with others:

Posted Monday, July 23, 2012