Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Site definition configurations are contained in files within %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE, while Web templates are stored as .wsp files in the SharePoint Foundation database.
Use the GetCustomWebTemplates method of the SPSite class to return the collection of Web templates created through the user interface or the object model, or use the GetWebTemplates method of the SPSite class to return the collection of site definition configurations in the site collection. After you have a reference to a collection, use an indexer to return a single site definition configuration or site template. For example, if the collection is assigned to a variable named mySiteTemplates, use mySiteTemplates[index] in Microsoft Visual C#, or mySiteTemplates(index) in Microsoft Visual Basic, where index is either the title or the index number in the collection of the site definition configuration or Web template.
A site definition, which is a kind of container for one or more site definition configurations, is expressed, in Collaborative Application Markup Language (CAML) markup, by a Template element in a WebTemp*.xml file in the directory %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\LCID\XML\, where LCID is the numeric ID of your language/culture such as 1033 for English. How a site definition configuration appears in the UI when a user is creating a new site is determined by one of the child <Configuration> elements of the Template element. Details of the site definition configuration are stored in one of the Configuration elements in the Onet.xml file in the directory %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\15\TEMPLATE\SiteTemplates\site_type\XML\, where site_type is "STS," “SGS,” "MPS," "BLOG," "WIKI," "CENTRALADMIN," “TENANTADMIN,” or the name of a custom site definition.
A Web template is defined in an elements.xml file that is compressed into the .wsp file. (An .wsp file is a CAB file. You can open it in Windows Explorer if you first change the extension to .cab.)
While an can represent either a site definition configuration or a custom Web template, an SPCustomWebTemplate always represents a custom Web template.