How do I go about making a site template to a site definition? For example, if I have a modified team site which I saved as WSP (save as site template), can I import that into VS2010 and convert to a site definition? Are there any gotchas that I should be aware of?

Thanks for your help in advance.


2 Answers 2


A Site Template is essentially a WebTemplate, just pre-packaged. It's NOT a Site Definition.

If you would like to distribute it "globally" in your farm, crack the WSP open and edit the Feature and set the scope to Farm (instead of Site). (Quck and dirty solution)

Even better is to crate a Web Template of your own and copy and paste pieces from the Site Template that you exported - and imported into a new Visual Studio Project. I strongly discourage you to import the solution package and fiddle with that project and then re-deploy it. Been there, done that! That is - create a new project and only use the "imported" project as a temporary copy-and-paste solution.

Read more about Web Templates here: http://blogs.msdn.com/b/vesku/archive/2010/10/14/sharepoint-2010-and-web-templates.aspx

  • Actually, I don't like to use a generated code too. It is a big pain to modify and support it. We tried to use generated code in our main project at work, and failed. I finished with code approach, and now all our 50+ list definitions with instances and content, and many pages are created by code. But this all depends on what do you want. If you need, for example, just to create several very static pages and lists, which will never be changed or localized, and accumulate all these pages and lists in one WSP with your own webparts and customizations - import approach is what you need! :) May 13, 2011 at 19:18
  • 1
    Problem is with import that so much crap is included. If you're not that experienced you have hard time selecting what to remove and what to not remove. May 13, 2011 at 19:26
  • Yep, and I'm afraid that it is much simplier even to create all the content manually, than use partial copy-paste. Generated XML is completely different from, for example, MSDN samples. Much harder to understand, and parts of this XML are linked with each other deeply. Import approach can only be used for simple and not-changing solutions. And if you need localization or content upgrading, better not to deal with generated code at all :) And maybe even not to deal with XML code, and try to use, for example, SPGenesis framework: spgenesis.codeplex.com May 13, 2011 at 19:41
  • There are a couple of gotchas with frameworks that tries to abstract away from the SP framework. First of all you can't do everything in code, secondly your devs will unfortunatley not undestand what's really going on, third requires a non supported framework to include in your ALM etc etc May 13, 2011 at 20:07
  • SharePoint XML is a very buggy thing, also it is typo-prone and full of magic strings. It is simply unpredictable! And errors... You could spend hours to find a very simple error, like missed space. Did you see SharePoint error descriptions?:)) Code approach is much better, really. Even if I can't do something without xml, I will write some wrappers to generate the XML and also I will write tests for this wrappers. Ok, I will need to do some work, but my code after this will be stable and predictable. And this is very important, when you work in a team, and your project is really huge. May 13, 2011 at 20:23

You can import your WSP into Visual Studio, using special project type, "Import SharePoint Solution Package":

Import SharePoint Solution Package

Microsoft provides walkthrough on how to do this:

And what about web templates, I recommend you to check out this awesome post from @Chris Beckett:

Note: you should use import only if you know what you're doing. Please, see Wictor's answer and it's comments for details and drawbacks.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.