SharePoint: The following sites are using templates that are not yet supported after upgrade

I migrated a SharePoint 2010 site collection containing a custom site definition to SharePoint 2013 using database attach. The site collection had several sub sites created using the custom site definition. I deployed the SP 2010 WSP containing the Site Definition to 14 hive initially. The new site collection worked properly in SP 2010 mode. 
Now in order to upgrade to SP 2013, I upgraded the project containing the site definition in Visual Studio 2012. I created a new WSP and deployed it to 15 hive. I could see the webtemp_siteDefinitionName.xml file in \15\TEMPLATE\1033\XML. Moreover, when I ran the PowerShell command: Get-SPWebTemplate -CompatibilityLevel 15, the custom site definition showed up. However, when I tried to perform the actual upgrade either from UI or PowerShell command Upgrade-SPSite I got the error:
Missing Site Templates
The following sites are using templates that are not yet supported after upgrade.
Resolution:
Both versions of the site definitions (14 and 15) need to be present  in respective hives at the time of performing upgrade. If either of them is absent the above error will show up. I had deployed the version 15 WSP using PowerShell commands:
Uninstall > Remove > Add > Install. This had removed the previous site definition files (onet and template folder) from 14 hive and added latest files to 15 hive. When I copied the old files to 14 hive, the upgrade worked.

profile for Nadeem Yousuf at SharePoint Stack Exchange, Q&A for SharePoint enthusiasts

+