Wednesday, September 12, 2012

Sharepoint 2010 - Create a Site Collection Template without Errors...

(I know, the title of this post is misleading ...)

I had to create a template for Site Collection and, according to various posts and tutorials, the procedure seems very simple: Save site as template, Import into a new project in Visual Studio 2010, changing some scope, put into hidden some features and recompile.
Then, upload wsp on farm, deploy and so on ...

Everything is fine until I try to create a new Site Collection using the new template.
The page loading... and ... error "File not found"!!
In the log file, nothing about which files it is searchin for.

I found no solution, my template was not so complex, but did not understand why this error.

In the end, the lighting has arrived.

We know that is not possible (in theory) save a site as a template if it has the Publishing Feature activated.
"In theory", because through the direct link to the page, you can save it as template.
But Microsoft does not support this type of template (site with publishing feature activated), so they hide us the link.

In case of a top-level site of a site collection, even if Publishing Feature in NOT activated but, in Site Collection, Server Publishing Infrastructure Features is activated, we can Save site as model, BUT we get errors!

Activate Server Publishing Infrastructure Features creates some lists and libraries of type "publishing".
Unfortunately, turn them off  does not eliminate what was created and it seems that these items are the cause of the failure in create new site collection from template.
Although this does not give errors in creation, build and deployment.
And if we use this template for a new site in a Site Collection (yes, we can do), it's ok.

So, if you want to create a Site Template for a Site Collection, you DO NOT EVER activate the Server Publishing Infrastructure Features in Site Collection!

Lesson to learn..