A while ago I blogged about creating a custom site definition for WSS 3.0/MOSS 2007. The problem I experienced today was with a WSS 3.0 installation and creating sites programmatically.
Say I have copied the STS Site Definition and made some changes so only the 'blank' template remains. I add the webtempstsvandest.xml file to the correct location and restart IIS.
Next I create a new site with the Site Definition and save it as a template MyCustomSite.stp.
When I call the SPWebCollections.Add(url, title, desc, 1033, "MyCustomSite.stp", false, false); only to receive the following exception:
File or arguments not valid for site template
The problem in my case was in the webtempstsvandest.xml file which looked like this:
The culprit is the AllowGlobalFeatureAssociations attribute that is set to false. This should only be the case for the Blank Site site template and the Shared Services Provider site template.
Creating a site using the GUI does not give the above exception but creating a new Document Library on that site will likely fail.