I ran into this error when I was creating new upgraded solutions from 2007 templates and needed to get around it. Normally I would have used “stsadm -o setproperty -propertyname max-template-document-size -propertyvalue 50000000” to do so but sadly I kept getting a “Windows SharePoint Services Tool Has Stopped Working” error so I needed to find another way. Then I thought of using PowerShell to do the same thing, so I created a script to do so. I noticed that someone had created some script for enabling the Developer Dashboard. Since the property “MaxDocumentTemplateSize” is a part of the same SPWebService class, I decided to retrofit it to meet my needs. I hope it helps you.
This script will by default reset the size of your WSP solution creation size to 50mb. If you would rather something different then call the script with the parameter “TemplateDocSize” and set it to your choice in bytes.
To Download the PowerShell Script Click Here
UpdateMyDocTemplateSize –MaxDocumentTemplateSize <Number Of Bytes>
UpdateMyDocTemplateSize (Reset Size to 50mb)
UpdateMyDocTemplateSize 30000000 (Reset size to 30mb)
UpdateMyDocTemplatesize –MaxDocumentTemplateSize 30000000 (Reset size to 30mb)