SPSource is a tool for SharePoint developers to assist in the creation of WSS Solution Packages (WSPs) allowing for the use SharePoint Designer and the SharePoint web UI to make quick changes to items, then push those items into Visual Studio for later compilation into a WSP.
Creating Features which contain custom Content Types or file provisioning modules requires developers to write a lot of XML based on the wss.xsd. Content types require custom columns and content type definition files, along with the proper creation of the content type IDs. File provisioning modules require the creation of module elements which contain the information that will help properly push the files into the correct lists when the Feature is activated.
More over, List Templates are am absolute pain to code from scratch with a simple Generic List Template with one column and one view having a schema.xml file well over 2500 lines long with the out of the box Features!
This XML can be fairly daunting, time consuming, and frankly, not very exciting for developers who just want to test their code. This holds especially true for developers who are writing custom Features based on SharePoint's Publishing Feature.
SPSource helps by alleviating the need for developers to write these files by allowing them to use the SharePoint UI and SharePoint Designer (SPD) as the source for the files defined in the module elements, along with custom content types, and is meant to be integrated with WSP creation tools such as WSPBuilder, STSDev, and the WSPProjectTemplate as part of the build process, but it can also be executed as a CMD or BAT file at the root of your project to get you moving quicker. Executing BEFORE the creation of the WSP, any file that can be created using SharePoint Designer in a document library, and any site content type created in the SharePoint UI can be targeted and pulled down into Visual Studio for addition in a new or pre-existing WSP project. SPSource will also create the file provisioning module and site Content Type/Column definition files. The only thing the developer is left with is to add the ElementManifest and ElementFile lines to the Feature.xml file.
Why use it over VSeWSS Solution Generator?
Solution Generator uses a different approach to reverse engineer List Templates using the RPC Web Services, which requires some XPATH hacking to remove some illegal attributes and add some needed elements. The SPSource approach is based on the documented schema and generates the required elements and attributes based on the targetted instances to provided a much cleaner end solution. One example of this is the fact that it will intelligently try and fix up same-site lookup columns to list within the schema.xml file to save having to create these in a programmatic fashion.
Some examples of what can be done using SPSource:
- Completely define a custom Publishing Feature using SPD and the SharePoint UI, creating the master pages, page layouts, content types, style sheets, and images directly in the content database. Once at a point where it's ready for deployment, run SPSource against the project and pull everything into a pre-existing WSP. If changes are needed in the markup, make them using SPD, and re-run SPSource. The files in the WSP will be updated and ready for a solution upgrade.
- Implement a class on an ASPX page (code behind) in SPD, and code that class in Visual Studio, or add custom server controls to the markup in SPD. Push your assembly directly to the GAC or bin as part of the build process, and the code-to-test time is much faster, as the markup files are already in the content database. Once everything is set, run SPSource again the project, and pull everything together into the WSP.
- Add a custom Content Query Web Part (CQWP) .webpart file to the web part gallery, and change the properties and settings for the new CQWP via the UI and SPD to use custom XSL files that you add to the Style Library/XSL Style Sheets folder. Create new ItemStyles, change the Headers, or add new parameters to the Main XSL. The XSL files can be updated quickly using SPD, and changes can be seen right away. When all is ready for integration into the WSP, execute SPSource against the new files and create a new Feature for the new web part in minutes.
- Create a complex List instance with Content Types and related Site Columns and reverse the whole lot out to a Feature to deployed to another environment as a Solution Package (wsp) using your favourite tool: VSeWSS, WSPBuilder or STSDev.
Eventually, other Feature elements such as Workflow will be available. Please feel free to discuss other future features in the Discussions section!