How to use the SharePoint Software Factory?

The SharePoint Software Factory is a Visual Studio Extension helping SharePoint newbies, as well as experienced developers to create, manage and deploy SharePoint solutions without having to know every tiny XML and C# secret.

SPSF provides a huge collection of helpful recipes for development, debugging and deployment of SharePoint standard artifacts and is fully compatible with SharePoint 2007/2010/2013 and Visual Studio 2008/2010/2013.

This post is part of a series which shows how you get the most out of SPSF.

Introduction

To unleash the power of the SharePoint Software Factory, the SharePoint application project has to fulfill some requirements like solution/project structure and existing configuration files. Creating such a project with SPSF does NOT leave you stuck with it forever. At any time you wish to continue development without SPSF, you can uninstall it and your projects will still be compilable and deployable. After successful installation of SPSF SharePoint SoftwareFactory you get started in Visual Studio.

After installing the Visual Studio extension you downloaded from the Visual Studio Gallery (VS2012, VS2010, VS2008)

Create a new project in Visual Studio

Start Visual Studio 2012 and click “File -> New -> Project” to create a new Visual Studio project.

In the new project dialog in the section “Guidance Packages -> SharePoint SoftwareFactory” choose the desired project template e.g. “SharePoint 2013 – Application”.

Click “OK” and the SPSF project wizard will open.
There you can specify the settings for your solution (i.e. if you want to store language resources in a separate project and if SPSF should handle them).

After clicking finish, a SPSF solution is created which contains a SharePoint project, an optional resources project and a deployment project along with the necessary solution files for automatic code analysis (only on release build), WSP packaging and SPSF configuration.

Run SPSF recipes to create SharePoint code

Most SPSF recipes are displayed in context menus depending on the current selection. For instance the recipe “Content Type” is only displayed on projects which will create a .wsp solution. Some files and folders have also additional recpies to refactor artefacts, e.g. a feature has a recipe to add feature dependencies.

Alternatively you can use the “Add -> New Item…” (Ctrl+Shift+A) dialog to run the SPSF recipes.

The recipe will open a SPSF wizard, which allows you to specify the required information and choose dependencies from existing artefacts in your project or to out-of-the-box SharePoint components.

When you finish the wizard the code will be generated by SPSF following best practices for naming the files and structuring of the solution. If you have enabled resource managment upon project creation all language resources will be automatically stored in .resx files.

All settings you made in the wizard are reflected in the generated files.

From there you can continue development like you would do without SPSF.

Build a deployment package

Whenever you require a deployment package which contains all WSP files or if the solution should be deployed to a different farm, you can build the “Deployment” project which collects all solutions, deployment configurations and the necessary PowerShell scripts.