Visual Studio 2010 SharePoint Developer Tools improve the development process on the SharePoint 2010 platform. By simplifying the packaging process they allow you to focus on the development rather than the packaging plumbing. Unfortunately, when working with larger solutions, it might get challenging for you to track which SharePoint Project Items are used where. Find out how to easier track the references to SharePoint Project Items with Mavention SPI References.
Getting efficient with Visual Studio 2010 SharePoint Developer Tools
Visual Studio 2010 SharePoint Developer Tools simplify developing on the SharePoint 2010 platform – no doubt about it. By adding an extra layer of abstraction they hide all of the internal plumbing and allow developers to focus on the real work: crafting solutions for their customers.
Standard the Visual Studio 2010 SharePoint Developer Tools contain a number of templates, wizards and designers: all of that to make our life easier and help us be more efficient. Probably the most frequently used pieces of the new tools are the Package and Feature designers that allow us to visually package SharePoint assets into Features and Packages. By visually presenting all assets from the current solution, it’s just a matter of a few clicks to have your SharePoint Solution packaged and deployed.
The great thing about the standard Package and Feature designers is, that they not only show assets from the current project, but from all other projects in the current solution as well, allowing you to separate your solution into logical pieces and yet package them into a single WSP without too much effort.
Package and Feature designers vs. big solutions: the challenges
Although the way the Feature and Package designer work looks good, there are a few challenges, especially when working with somewhat larger projects.
Automatically adding newly created SharePoint Project Items to Features
The main goal of the Visual Studio 2010 SharePoint Developer Tools is to make development on the SharePoint 2010 platform easier so that developers can focus on the real work instead of the packaging plumbing. One of the nice features of the tools in improving the efficiency is automatically adding each newly created SharePoint Project Item (SPI) to a Feature. The cool thing is that the tools try to determine the best match using the information about the SPI and available Features. For example if you add a new Content Type the tools will automatically try to find a suitable Site Collection Feature to add the Content Type to, so that you don’t have to worry about it and can focus on crafting the Content Type.
Unfortunately as your project grows and you start adding more items and Features it will get more difficult for the tools to try to figure out where you would like to add the SPI that you’ve just created to. As a result the SPI will be added to some Feature and it’s up to you to check if it’s in the right place. You will not only have to find out where the item has been added but will also have to add it to the right Feature if the default is not what you had in mind.
Adding the right SharePoint Project Item to the right Feature/Package
As your project grows another challenge emerges. The Package and Feature designers allow you to visually choose the contents of your Packages and Features. By presenting the list of all SharePoint Project Items in your solution including some additional information, they allow you to compose your Features and Packages with no more than a double click on the desired items. Unfortunately, the more SPIs you have in your solution, the less overview you will get and the more difficult it will be for you to find the right SPI. At this moment the Package and Feature designer lack filtering and searching what makes it difficult to work with larger projects with many SPIs.
Getting efficient in working with SharePoint Project Items with Mavention SPI References
Mavention SPI References is a custom extension for the Visual Studio 2010 SharePoint Developer Tools that allows you to be more efficient when working on larger SharePoint projects with many SharePoint Project Items.
Upon installation the Mavention SPI References extension adds a number of items to the context menu of every SPI type.
Adding a SPI to the right Feature
One of the improvements that Mavention SPI References includes is an easier way of adding SPIs to Features. To add a SPI to the right Feature all you have to do is to click right button on the SPI that you want to add to a Feature. Then choose from the menu Add > Add to specific Feature….
After clicking this option, the Select Feature dialog window will appear on the screen.
Using this dialog window you can easily filter the Features’ list using a contains match on both the Name and the Title of the Feature.
Additionally you can choose to display Features from a specific project only.
To make it even easier for you, you can narrow the list using both filters at the same time. Additionally, when composing the list of available Features, Mavention SPI References checks which SPI Type you have selected and which Features support deployment of that SPI Type. For example, if you selected a Web Part, only Site Collection scoped Features will be displayed in the Select Feature dialog window.
To add a SPI to the given Feature simply choose the right Feature from the Feature list and press Enter or click the Add button.
Adding a SPI to the right Package
Some SharePoint Project Items are not being packaged using Features but are being directly deployed by the Package. If the SPI that you selected supports being deployed by the Package, the Add to specific Package… menu item will be displayed in the context menu of the SPI.
After clicking this option the Select Package dialog window will appear on the screen.
This window is very similar to the Select Feature window. You can also filter the list of available packages using a contains filter on the name of the Package. The only difference here is, that since there is only one Package per Project, there is no point of filtering Packages by Projects, so this filter has been removed.
Just like when working with SPIs and Features, in order to add a SPI to a Package, select the Package and either press Enter or click the Add button.
Tracking your SPIs
The Mavention SPI References extensions helps you track the usage of your SharePoint Project Items. Using the Find all references menu option you can find out which Features and Packages contain the selected SPI.
After you select a SPI and click the menu item, the Mavention SPI References extension will scan all Packages and Features in the solution and check if there are any references to the SPI that you selected. You can track the progress of the search using the Output window.
What makes it even easier for you to manage the references is, that if any references have been found, they will be displayed in the Error List window.
If you double click on any of those references the selected Package or Feature will open so that you can explore its details.
Removing SPIs from all Features and Packages
One last thing that the Mavention SPI References extension makes really easy for you is to remove all the references to the selected SPI. Using this option you can ensure that no Features or Packages are referencing your SPI and from there you can add the SPI to the right Feature and Package.
In order to remove all references to the selected SPI, click it right button and from the context menu select the Remove from all Features and Packages… option.
The Mavention SPI References extension will then scan the solution for all references and remove the SPI from all Features and Packages. Once again you can track the progress of this operation using the Output window.
This is the initial release of the Mavention SPI References extension, meant to get some feedback from you around working with larger SharePoint projects using the new Visual Studio 2010 SharePoint Developer Tools. We plan to include it in CKS:DEV v2.1 and would love to get your feedback to provide you with the best development experience possible.
I would like to thank Mike Morton and his team for the feedback and helping get this extension in its current shape. I’d also like to thank Wes Hackett and the dev team at PGGM for the feedback and ideas around this extension.