comexception (0x80004005): cannot complete this action when deploying a SharePoint MasterPage as a feature
I've been working on deploying SharePoint MasterPages and PageLayouts as a feature. There are a lot of good posts out there on how to do this. Everything went ok, the feature deployed and activated fine, the page was approved and I could specify the masterpage to be used. I checked to see how the site looked and all was not well. The page blew and I had a nice comexception error:
comexception (0x80004005): cannot complete this action
The strange thing is that the masterpage worked fine when manually uploaded to the masterpage gallery and only blew up when deployed as a feature. When searching the internet for comexception (0x80004005): cannot complete this action (what else do you do with COM exceptions and SharePoint?) I found information relating to identity impersonate, none of which was relevant the issue I was having.
I checked the application event logs and could see an ASP.NET 2.0.50727.0 warning message, with the event message "A parser error has occurred". Reading a bit further on into the event log entry I noticed "The type or namespace 'portal' does not exist in the namespace 'Microsoft.SharePoint' (are you missing an assembly reference?)". I checked the masterpage markup and noticed that a namespace was "Microsoft.SharePoint.portal.WebControls" when it should have been "Microsoft.SharePoint.Portal.WebControls".
In the end it was correcting a typo and paying good attention to what the event logs told me that saved the day.