I have a CQWP embedded in a custom page layout which points to the OOTB Contacts list. The requirement is that the CQWP should pull from the Contacts list that is local to the site. But when a CQWP is added to the page layout in sharepoint designer it always points to the Contacts list that is in the root site of the sitecollection. I resolved the above issue by opening the page layout in sharepoint designer, going into the code view and then setting the ListGuid property to null and webUrl property to ~site The above resolution worked but please read on to know about the issue that this thread is about.
When I took the modified page layout (in which ListGuid was set to null and WebUrl set to ~site) and made that part of a package which I deployed to another environment I found that the CQWP was not working properly. The CQWP was not referencing the itemstyle.xsl in the other environment as it should so it was not getting displayed properly. In order to fix it, I had to open the page layout in the new environment using sharepoint designer. Then I right- click the CQWP and click OK which would reset the ListGuid and WebUrl to their original values. Then I would in code view reset the ListGuid to null and WebUrl to ~site and save the page layout. After this every thing would work correctly. We have to give this package to external party and we cannot tell them to make these silly tweaks in sharepoint designer after the package gets deployed.
So has anybody come across this before and can someone give some suggestions? Thanks in advance.