Microsoft MVP Logo

    <p>In <a href="http://www.andrewconnell.com/blog/Announcing-ACs-VS-CodeRushRefactor-Tools-for-SharePoint-Devs-Part-1-of-5">Part 1</a> of this series on these little tools I created for SharePoint developers I gave a bit of an overview of what they are all about and where you can get additional information. In this post I want to spend some time taking a look at some of the templates I think will be used the most.</p>
    <p>Before you ask, yes, CodeRush (CR) templates are similar to Visual Studio (VS) snippets, except they have quite a bit more functionality. For example, I can embed functions within CR templates where I can't do that with snippets. Let's jump in and see one one of the more commonly used ones (least that I expect). </p>
    <p>Creating Feature definition files (feature.xml) files is repetitive. After a few weeks as a SharePoint developer, I expect you'll be able to do this in your sleep. What do you always have to do? Create a new GUID, give it a title, scope, and mark it's visibility. There's new a CR template named <strong>fxml</strong> (for Feature XML) that once you type it and hit space... well fire off the following animation to see it in action (the "Keys" tool window shows what I'm pressing on the keyboard):</p>
    <p align="center"><a title="Photo Sharing" href="http://www.flickr.com/photos/andrewconnell/1199718824/"><img style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" height="308" alt="fxml" width="552" src="http://farm2.static.flickr.com/1358/1199718824_501a8aba52_o.gif"></a></p>
    <p>Cool? Notice the GUID automatically created. And notice how I'm hitting ENTER to jump between the different "fields" (indicated with orange boxes). </p>
    <p>OK, cool... me like... you like? <strong>But wait, there's more!</strong></p>
    <p>Here's where the power of CR really starts to kick in. What if you had a Feature receiver class in your project? Wouldn't it be cool if it would automatically fill the ReceiverAssembly &amp; ReceiverClass attributes? Uh-huh... sure would! So, check out the <strong>frxml </strong>(for Feature Receiver XML) template. Assuming the project is signed and has already been built:</p>
    <p align="center"><a title="Photo Sharing" href="http://www.flickr.com/photos/andrewconnell/1199718618/"><img style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" height="332" alt="frxml" width="576" src="http://farm2.static.flickr.com/1366/1199718618_f4e2d60fff_o.gif"></a></p>
    <p>Notice how it got the assembly's strong name (aka: 4-part name)? If the project wasn't signed and / or built, it would have simply added <span style="FONT-FAMILY: courier new, courier, monospace">PublickKeyToken=[REPLACE_THIS]</span> at the end.</p>
    <p>You like now? Oh... before I go on, there are a TON of templates... over 45 of them! I created templates for the entire Feature schema, most of the Solution schema, field type definitions and a few others. All are listed, as well as links to screencasts demonstrating each (with a table-of-contents to jump to specific templates) on the main <strong>AC's VS CodeRush/Refactor Tools for SharePoint Devs</strong> page linked at the bottom of this post.</p>
    <p>Before I go on, let me explain how the templates are named. Each one is created as a mnemonic to make it easier to remember. I fully expect it will take some folks some time to get used to them, but when you think about it, they are quite intuitive. Want to create the contents of a new feature.xml file: <strong>fxml</strong>. What about a Feature with receivers: <strong>frxml</strong>. OK, what about an element manifest file: <strong>exml</strong>. What about adding a site column (element site column) [<strong>esc</strong>], then a new content type [<strong>ect</strong>] and a few field references in the content type [<strong>ectfr</strong>]. Cool... what about a new manifest.xml [solution definition]: <strong>sxml</strong>. And adding assemblies [<strong>sa</strong>] with safe control entries [<strong>sasc</strong>] as well as a new Feature manifest declaration [<strong>sfm</strong>]. Just think about what you're trying to type and it should be fairly intuitive... or just watch the screencast / read the docs!</p>
    <p>As a grand finale, check out the productivity gain once you get used to using these templates. This animation shows me creating a new Feature that contains a Feature receiver, add a new site column definition, and a new content type using the site column:</p>
    <p align="center"><a title="Photo Sharing" href="http://www.flickr.com/photos/andrewconnell/1202247439/"><img style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 1px solid; BORDER-BOTTOM: black 1px solid" height="431" alt="part2" width="575" src="http://farm2.static.flickr.com/1284/1202247439_f8e22a6d1c_o.gif"></a>
    <em>There is a much better, and bigger, screencast available on the main page, linked below.</em></p>
    <p>To get more information on the tools including documentation, links to detailed screencasts / demonstrations, and a history, check out the main page:</p>
    <p>&raquo; <a href="http://www.andrewconnell.com/ACs-VS-CodeRush-Refactor-Tools-for-SharePoint-Developers">AC's VS CodeRush/Refactor Tools for SharePoint Developers</a></p>
    <p>Let me know what you think! Oh... and I didn't name this post "part 1 of 5" for some random reason. Over the next four days, I'll add another post related to these productivity enhancements.  :)</p>
    <ul>
    <li><a href="http://www.andrewconnell.com/blog/Announcing-ACs-VS-CodeRushRefactor-Tools-for-SharePoint-Devs-Part-1-of-5">Part 1: Announcing AC's VS CodeRush/Refactor Tools for SharePoint Devs </a></li>
    <li><a href="http://www.andrewconnell.com/blog/Working-with-Templates-in-ACs-VS-CodeRushRefactor-Tools-for-SharePoint-Devs-Part-2-of-5">Part 2: Working with Templates in AC's VS CodeRush/Refactor Tools for SharePoint Devs</a> </li>
    <li><a href="http://www.andrewconnell.com/blog/MOSS-Publishing-Templates-in-ACs-VS-CodeRushRefactor-Tools-for-SharePoint-Part-3-of-5">Part 3: Special Templates in AC's VS CodeRush/Refactor Tools for SharePoint Devs for Publishing Sites </a></li>
    <li><a href="http://www.andrewconnell.com/blog/Use-of-StringProviders-in-ACs-VS-CodeRushRefactor-Tools-for-SharePoint-Devs-Part-4-of-5">Part 4: String Providers in AC's VS CodeRush/Refactor Tools for SharePoint Devs </a></li>
    <li><a href="http://www.andrewconnell.com/blog/Creating-custom-Refactorings-for-use-in-Refactor-Pro-The-quotCreate-Web-Part-Definitionquot-Refactoring-Part-5-of-5">Part 5: Creating custom Refactorings for use in Refactor! Pro: The "Create Web Part Definition" Refactoring</a> </li>
    </ul>
    <div class="wlWriterEditableSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:367f05fa-6af9-45fc-9b26-1e37cdf908f5" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">Technorati tags: <a rel="tag" href="http://technorati.com/tags/sharepoint">sharepoint</a>, <a rel="tag" href="http://technorati.com/tags/wss">wss</a>, <a rel="tag" href="http://technorati.com/tags/moss">moss</a>, <a rel="tag" href="http://technorati.com/tags/publishing%20site">publishing site</a>, <a rel="tag" href="http://technorati.com/tags/dxcore">dxcore</a>, <a rel="tag" href="http://technorati.com/tags/coderush">coderush</a>, <a rel="tag" href="http://technorati.com/tags/refactor%20pro">refactor pro</a></div>
Comments powered by Disqus