AC's VS CodeRush/Refactor Tools for SharePoint Developers

Enhancements for Visual Studio 2005/2008 developers with CodeRush and Refactor! Pro. Latest releases tested, download section to be updated.

Want to download the resources associated with this article? Jump to the end 👇

This page serves as the portal for all information related to the productivity enhancements I’ve created for developers using Visual Studio 2005 / 2008 with DevExpress’ CodeRush & Refactor! Pro.

Requirements

These tools have been tested with the latest releases of CodeRush & Refactor! Pro: v3.0.5 in both Visual Studio 2005 & 2008.

Download

This part of the page will be updated with the latest release of the components. How can you get news on when the latest are available? I’ll post to my blog when there’s a new update, so you can subscribe there to get updates as well as my other posts.

The ZIP associated with this article includes a sample project you can use to play around with the tools without mucking up your project to get the feel for them.

Installation

Installation can be done in one of two ways (one day I’ll get a WiX installer set up… but until then…):

Semi-automated

The provided install.bat file can do most of the work… but it can’t import the templates.

  • Double-click the install.bat file included in the download. This will deploy the dynamic templates, plugins and refactorings.
  • If Visual Studio is open, you need to close and restart it to pickup the plugins and custom types.
  • Open Visual Studio and select DevExpress » Options.
  • In the Options dialog, navigate to the following section: Editor » Templates.
  • At the bottom of the dialog, set the Language to XML.
  • Right-click the Templates pane (white vertical box just to the right of the navigation tree) and select Import Templates. Select the XML file XML_SharePoint.xml to import the templates.
  • At the bottom of the dialog, set the Language to Plain Text.
  • Right-click the Templates pane (white vertical box just to the right of the navigation tree) and select Import Templates. Select the XML file PlainText_SharePoint.xml to import the templates.

Manual

You will copy a handful of files to your profile, assemblies to the plugins directory and import the templates. The easiest way to get to the plugins and settings directories is to use the DevExpress About menu. Open Visual Studio and select DevExpress » About. Click the Settings… or Plugins… button to open the desired folder in Windows Explorer.

  • Copy the assemblies (3 DLL’s) to the Plugins directory: C:\Program Files\Developer Express Inc\DXCore for Visual Studio .NET\2.0\Bin\Plugins
  • If Visual Studio is open, you need to close and restart it to pickup the plugins and custom types.
  • Open Visual Studio and select DevExpress » Options.
  • In the Options dialog, navigate to the following section: Editor » Templates.
  • At the bottom of the dialog, set the Language to XML.
  • Right-click the Templates pane (white vertical box just to the right of the navigation tree) and select Import Templates. Select the XML file XML_SharePoint.xml to import the templates.
  • At the bottom of the dialog, set the Language to Plain Text.
  • Right-click the Templates pane (white vertical box just to the right of the navigation tree) and select Import Templates. Select the XML file PlainText_SharePoint.xml to import the templates.

Custom Types

CodeRush has a ton of features that allow you to create new fields or methods returning types using specific types. For example, typing fs[space] will create a new field based on the language you’re in so if it was C#, it would create private string varName;. Thankfully you have the ability to create your own types that aren’t already registered. For more info on custom types, check out Mark’s post or this feature page on the DevExpress site.

The custom types included in the download contain four of the most popular SharePoint types: SPSite, SPWeb, SPList & SPListItem. Best part is that if the namespace Microsoft.SharePoint hasn’t already been imported, it’s automatically added. Check the screencasts to see a demonstration of this.

The four types included in the download are the following:

TemplateDescription
spctMicrosoft.SharePoint.SPContentType
spcsMicrosoft.SharePoint.SPContext.Current.Site
spcwMicrosoft.SharePoint.SPContext.Current.Web
spfMicrosoft.SharePoint.SPField
spsMicrosoft.SharePoint.SPSite
spwMicrosoft.SharePoint.SPWeb
splMicrosoft.SharePoint.SPList
spliMicrosoft.SharePoint.SPListItem

Note added for v1.1: You don’t need to install these… in fact they were removed starting with the v1.1 download. DevExpress is now including these templates in the default CodeRush install starting with v3.0.

Refactorings

  • Create Web Part Definition (*.webpart): When the cursor is on a class that inherits from System.Web.UI.WebControls.WebParts.WebPart, this refactoring will automatically create a *.webpart file and add it to the project that already contains the Web Part class. In addition, the *.webpart file will be prefilled with the full type name (5-part name) and Web Part name.

XML Templates

The following tables document the various XML templates included in the download. For a demonstration, check the screencasts listed at the end of this page. Each of the screencasts demonstrating a template contains a table of contents with the name of the template for easily jumping to a specific demonstration in longer screencasts.

While the templates may seem complicated or hard to remember, notice they are written as mnemonics. For example, when you want to create a new within a element, you are creating a element content type field reference… or ectfr.

General / Misc. Templates

TemplateDescription
assemblyfullnameFull name of an assembly, 4-part name.
ftdField type definition.
newguidGenerate a new GUID.
webpartxmlGenerate contents of a *.webpart file, automatically filling in the Web Part’s type (5-part name) if it finds one within the current project.

Feature Definition Schema Templates

TemplateDescription
fxmlFeature definition file contents.
frxmlFeature definition file for Feature receiver. If type inheriting Microsoft.SharePoint.SPFeature is found in the class, both the type and assembly full name are automatically filled.
fwxmlFeature definition file for Feature containing custom workflow that utilizes InfoPath forms.

Feature Element Manifest (Site Element) Schema Templates

TemplateDescription
exmlElement XML file.
ecaElement custom action.
ecagElement custom action group.
ectElement content type. Note: If a content type ID is on the clipboard, such as copied from another content type, it is added in the ID attribute automatically.
ectbElement content type binding. Note: If a content type ID is on the clipboard, such as copied from another content type, it is added in the ID attribute automatically.
ectfrElement content type field reference. Note: If a GUID is on the clipboard, such as copied from a site column / field definition, it is added in the ID attribute automatically.
educ / edcElement delegate control (as a user control).
edscElement delegate control (as a server control).
eerElement event receivers collection.
eerrElement event receiver.
efstaElement feature site template association (stapling Feature). Note: If a GUID is on the clipboard, such as copied from a Feature definition, it is added in the ID attribute automatically.
ehcaElement hide custom action. New in v1.1.
eliElement list instance.
eltElement list template. Updated in v1.1.
emElement module.
emfElement module file. Updated in v1.1.
emfpElement module file property.
emwpElement module file for provisioning Web Parts into the Web Part Gallery.
escElement site column (field). Updated in v1.1.
ewElement workflow.
ewifElement workflow using InfoPath forms.
ewpElement workflow using ASP.NET 2.0 pages as forms.

Feature Element Manifest Schema Templates for Publishing Sites

TemplateDescription
ectppElement content type inheriting from Page content type.
emmpElement module provisioning master page file set.
emmpfElement module master page file. Updated in v1.1.
emplElement module provisioning page layout file set.
emplfElement module page layout file. Note: If a content type ID is on the clipboard, it is automatically added to the PublishingAssociatedContentType attribute.
empiElement module preview image.
emslElement module for items in the Style Library.
eschtmlElement site column using the Publishing HTML field type.

Solution Schema Templates

TemplateDescription
sxmlSolution node (within manifest.xml).
saSolution assemblies node.
sascSolution assembly safe control.
sacrSolution assembly class resources.
sfmSolution Feature manifest.
swp / sdwpSolution Web Part / DWP file provisioning to wpcatalog.
srSolution resources.
srrSolution resources. New in v1.1.
stfSolution template files.
stffSolution template file. New in v1.1.
srfSolution root files.
srffSolution root file. New in v1.1.

Where To Get More Information?

Where can you get additional information? Below you’ll find a handful of blog posts and screencasts. I think the screencasts are the best way to demonstrate exactly what these things can do.

Blog Posts

Change Log & Updates

  • AC’s CR/R tools for SPDevs Updated: v1.1

Screencasts (demos)

Note: I’m aware the videos sometimes appear horizontally scrunched up… usually a few hard refreshes fixes it, but I’m still trying to figure out the root cause to resolve it. Regardless, they are still viewable and you should be able to see what is being presented just fine. If not, please let me know.

Note: all videos are for v1.0 and have not been updated for v1.1.
  • Overview: (updated August 22, 2007) Get a quick overview of what is included.
  • Installation: (updated August 22, 2007) Covers both the manual and semi-automated installation process.
  • Templates and Custom Types: (updated August 22, 2007) Demos of some of a few templates not included in the Feature & solution schemas and the custom types.
  • Feature Schema: (updated August 22, 2007) Detailed demos of all Feature schema templates. Notice the table-of-contents allowing you to quickly jump to a specific template.
  • Solution Schema: (updated August 22, 2007) Detailed demos of all solution schema templates. Notice the table-of-contents allowing you to quickly jump to a specific template.
  • Templates specific to Publishing sites: (updated August 22, 2007) Detailed demos of all templates useful for developers creating Publishing sites. Notice the table-of-contents allowing you to quickly jump to a specific template.
  • Refactorings: (updated August 22, 2007) Detailed demos all refactorings.

DevExpress’ CodeRush & Refactor! Pro

I wrote a post a while back giving my perspective on what these tools were all about. I think it’s a pretty good and quick read:

The next best place to go is to check the product pages for these two products on the DevExpress Web site:

I’ll admit, it’s hard to really get a grasp of these tools by simply reading some pages on a Web site. DevExpress saw this and added a bunch of screencasts to their site. Even after using these products on a daily basis, I pick up stuff every single time I watch these!

Download article resources

Want the resources for this article? Enter your email and we'll send you the download link.
Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a full stack developer who focuses on Microsoft Azure & Microsoft 365. He’s a 20+ year recipient of Microsoft’s MVP award and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s mission is to help web developers become experts in the Microsoft 365 ecosystem, so they can become irreplaceable in their organization.

Share & Comment