SharePoint 2007: The template you have chosen is invalid or cannot be found

I ran into an error at work recently when I went to deploy my new SharePoint site, which was a site definition inside a SharePoint solution file.

I was deploying the site to our build server.  I added the WSP to the farm, deployed it to the web app, and then went to create the new site based on my template.  However, I got an error almost immediately, after clicking create.  The error was “The template you have chosen is invalid or cannot be found”.  I check to make sure that the solution had been deployed and even checked that the files were in the 12hive.  Ok, good there.

I retracted/deleted the solution and redeployed.  No luck.

So, I went back to my dev environment, removed the solution, and followed the same steps I did on the build server – no error. Huh?  I turned to Google and amongst the noise, I luckily found this blog post:

At that point, I remembered that another developer on my team had recently deployed a new site he is working on. (BTW – he has a great blog: ) Well, since we hadn’t installed each other’s sites onto our local dev environments (Virtual PCs running locally on our laptops), we didn’t notice that we had both picked the same  Template ID.  This ID is located in the WEBTEMPsitename.xml file, like this:

<?xml version="1.0" encoding="utf-8" ?>
<!-- _lcid="1033" _version="12.0.4518" _dal="1" -->
<!-- _LocalBinding -->
<Templates xmlns:ows="Microsoft SharePoint">
  <Template Name="PortalAdministration" ID="11006">
    <Configuration ID="1"
    Title="Portal Administration"
    Description="Custom site definition for Portal Administration"
    DisplayCategory="Admin Sites">

We did this because after searching the sites we had already created, this number was the next on in the sequence.

Once I had discovered all of this, the fix went pretty quick: change the ID, rebuild the WSP, redeploy and voila!  The new site created just fine.

Print | posted @ Friday, December 11, 2009 12:12 PM