Error when deploying WebTemplate: "Error occurred in deployment step 'Add Solution': Exception from HRESULT: 0x8107026E"

2011, Jan 14

Recently I was working on a sandboxes solution, which included a WebTemplate (Vesa "Vesku" Juvonen wrote a really nice post about it), but I couldn't deploy it, the followin error was displayed into Visual Studio 2010:

Error occurred in deployment step 'Add Solution': Exception from HRESULT: 0x8107026E

After checking the Logs (in %SHAREPOINT ROOT%\\LOGS) the following error was found: Failed to open the file 'Features\AD6.Public\AD6_Web\AD6PublishingSite\onet.xml'. #2006e: The specified path "" does not exist. Failed to read file "Features\AD6.Public_AD6_Web\AD6PublishingSite\onet.xml" from feature id "6f87a30b-b785-4483-a1f4-25a1150ebda4"._

img 52a49fd3294b1

After comparing that location to the supposed deployment location, I found out why the error was generated: the onet.xml was deployed to another location:

img 52a49ff224abd

Instead of "Features\AD6.Public\AD6_Web\AD6PublishingSite\"_ the onet.xml was deployed to "Features\AD6.Public\AD6_Web\AD6Publishing"._ But why? A "Find" (ctrl+shift+f) on "AD6PublishingSite" scoped to the complete solution, gave me one single result. The name of the webtemplate was the exact match:

img 52a49ffe6f738

After changing the webtemplate name to "AD6Publishing" (or changing the Module name to AD6PublishingSite"), I was able to deploy the solution correctly.

Lessons learned: the webtemplate name and it's module it resides in, require you to have the same name!