I tried to create a web template from scratch through Visual Studio 2010. This article explains it in full detail. After creating an empty element, adding it to a feature, I got the following error:

Error occurred in deployment step ‘Add Solution’: Elements of type ‘WebTemplate’ are not supported at the ‘Farm’ scope. This feature could not be installed.

Euuh?

What was the problem: the project was a sandboxed solution… This error really did not make any sense (WebTemplates ARE supported at farm scope), the problem was that Farm-scope features are not supported in Sandboxed solution.

Another little mistery solved 🙂