Posts Tagged ‘Tools’

Tools for your SharePoint 2013 development toolbox

January 18th, 2014 by Tobias Zimmergren

Author: Tobias Zimmergren
www.zimmergren.net | www.sharepointdiscussions.com | www.pointbird.com@zimmergren

Introduction

Some of my students, clients and community peers have asked about my favorite tools for working with SharePoint. So with that in mind, I quickly noted down some of my favorite tools that every developer should have in their toolbox. I’ve written posts about this before but as times and technology moves forward, new tools and techniques are evolving. I may post about the tools I recommend for IT-Pros at some point, but right now let’s stay on track with the dev-focus.

If you think I’ve missed out on some great tools, let me know by commenting on the article and I’ll make sure to include it in the post!

Recommended development tools

Here’s a brief list of tools that I would recommend for any SharePoint solution developer. At the very least, I would assume that you already have Visual Studio 2012 or Visual Studio 2013.

CAML Designer 2013

Historically I’ve been using some kind of CAML query generator since the U2U CAML Query Builder tool was released. There’s really no other efficient way to build your CAML queries than have the stubs auto-generated with a tool. For SharePoint 2013 I am now solely using the CAML Designer tool available from www.camldesigner.com.

The application is a lot more enhanced than any predecessors and I highly recommend that you download it right away unless you’ve already done so. There’s some tweaks that has to be made in the tool before it’s feature complete, but hey it’s a community tool and the best one I’ve used thus far in the area. The best part is the auto-generated code samples that goes with your query. Yum!

Quick Highlights:

  • Autogenerate the actual CAML Query
  • Autogenerate Server OM code
  • Autogenerate CSOM .NET code
  • Autogenerate CSOM REST code
  • Autogenerate Web Service code
  • Autogenerate PowerShell code

    If you investigate the tool you’ll see that it does not only generate the CAML query itself, but also code-snippets for various technologies for you to copy and paste into your code as a stub to work with. Simple, elegant and so far it only crashes every now and then ;-)

    Screenshot:
    image

    Download: http://biwug-web.sharepoint.com/SitePages/Caml_designer.aspx

    SharePoint Manager 2013

    Since a friend of mine, Carsten Keutmann, started working on the SPM (SharePoint Manager) tool I have been impressed with it. It has been in the community for a long time and now the 2013 version is pretty slick. Simple and intuitive interface which allows you to quickly and easily navigate down the farm and investigate settings, properties, schema XML and so on. Most of the things in your SharePoint environment can be investigated from this tool.

    So unless you have downloaded this tool already, go get it now. Pow!

    Screenshot:
    image

    Download: http://spm.codeplex.com

    ULS Viewer

    I still keep getting the question about what tool I use to parse my ULS Logs. Honestly, there’s no alternative to the ULS Viewer. I’ve written about logging previously, including the ULSViewer tool: http://zimmergren.net/technical/sp-2010-developing-for-performance-part-4-logging. In SharePoint 2013 I use this tool on a daily basis, but I also use the built-in ULS viewer in the Developer Dashboard.

    ULS Viewer Windows Application Screenshot:
    image

    ULS Viewer in the Developer Dashboard:
    image

    For information about how to enable the developer dashboard and launch it, check out my mate Wictor’s blog: http://www.wictorwilen.se/sharepoint-2013-developer-dashboard-shows-no-data-issue

    Windows version download: http://archive.msdn.microsoft.com/ULSViewer

    CKS Dev

    A plugin for Visual Studio that is a killer-feature you can’t live without, is CKS:Dev. A team of awesome folks in the community have put together this amazing extension to Visual Studio and it now have support for 2013 as well. It allows you to manage your development routines more efficiently while you are on a coding adventure, it adds a bunch of new project items for your SharePoint projects and contributes to an overall satisfactory SharePoint developer story. You need this extension. Period.

    Download: http://visualstudiogallery.msdn.microsoft.com/cf1225b4-aa83-4282-b4c6-34feec8fc5ec

    Color Palette Tool for Branding

    With SharePoint 2013 comes new possibilities for branding. A lot of people are accustomed to wobbling up their own custom CSS files and have a designer do most of the branding parts. If you’re just looking to create new composed looks for SharePoint 2013 without too much effort, you should use the SharePoint Color Palette Tool, provided by Microsoft!

    image

    Download: http://www.microsoft.com/en-us/download/details.aspx?id=38182

    Debugger Canvas

    A few years ago I blogged about a tool called Debugger Canvas. A tool that can aid you in the debugging process. I’m not using it every day, but when I switch it on it really nails it! What can I say, if you hate the tedious normal debug execution and you want a better and more hierarchical way of displaying your trace in real time, enjoy debugger canvas awesomeness. All the code in your current calls displayed in one view type of thing. You’ve got to check it out.

    Note: The debugger canvas is for VS 2010 Ultimate. I’m not sure if they’ve gotten around to port it up to VS 2012 or VS 2013 yet; But if you’re lingering with 2010 Ultimate, you should get this now. Period.

    image
    (Screenshot is from the Visual Studio Gallery)

    Download: http://visualstudiogallery.msdn.microsoft.com/4a979842-b9aa-4adf-bfef-83bd428a0acb

    SharePoint 2013 Search Tool

    As we all know search is one of the biggest things in SharePoint 2013. This tool allows us to learn and understand how the queries can be formatted and allows us to easily configure a Search REST Query. Pretty slick if you ask me. Use the tool to create the queries for you, then you can analyze them and better understand how to tweak and modify the output. Great job with the tool!

    image

    Download: http://sp2013searchtool.codeplex.com/

    Fiddler. Always use Fiddler!

    For most experienced web developers, Fiddler has been a constant tool in the basket. It is an addition to many of the existing tools you can use, but it’s extremely slick for analyzing SharePoint requests on the client side. I’ve saved countless hours by using this awesome tool to analyze the requests and responses from SharePoint. Download it, learn it, use it.

    image

    Download: http://fiddler2.com/get-fiddler

    SPCAF – SharePoint Code Analysis Framework

    My friend Matthias Einig created a tool called SPCAF which analyzes your solutions and code. Truly a beneficial tool in your toolbox that will aid you in the direction of awesomeness. If you’ve developed crappy solutions, you’ll know it before you ship it off to production environments. It integrates with Visual Studio, there’s a stand-alone client application and you can even have it hooked up to your build process – something I’m doing with my Iterative Development Processes.

    highlevelresults
    (Image from SPCAF.com)

    Download: http://www.spcaf.com

    .NET Reflector from Red Gate

    It’s no secret that we want to peek into other peoples’ code. With the .NET reflector from Red Gate you can do just that. It’s an awesome reverse-engineering tool which allows you to peek into the code of a compiled assembly! I use it to debug Microsoft.SharePoint*.dll assemblies and to investigate third-party assemblies.

    image

    Download: http://www.red-gate.com/products/dotnet-development/reflector/

    F12 Debugging experience in your browser

    As Anders mentions in the comments, I forgot to mention the most obvious one. The F12-experience in your web browser. It enables you to debug and investigate HTML, CSS, JavaScript and other resources on your web pages on the client. Internet Explorer, Google Chrome and FireFox all have some type of developer tools available. For me personally, I use Chrome as my main debugging tool and IE for verification. I seldom use Firefox anymore to be honest.

  • How to use F12 Developer Tools to Debug your Webpages
  • How to access the Chrome Developer Tools

    PowerShell Tools for Visual Studio

    As Matthias points out in the comments, there’s another great extension for Visual Studio called PowerShell Tools for Visual Studio. It allows you to get syntax-highlighting on your PowerShell files directly in Visual Studio.

    image

    Download: http://visualstudiogallery.msdn.microsoft.com/c9eb3ba8-0c59-4944-9a62-6eee37294597

    SPFastDeploy

    Are you developing Apps for SharePoint 2013? Steve Curran commented about using the SPFastDeploy tool that he has created. It’s a great extension for quickly pushing changes to your dev site without having to re-deploy the entire app. Pretty neat!

    curran-spfastdeploy
    (Image from Steve Curran’s blog)

    Download: http://visualstudiogallery.msdn.microsoft.com/9e03d0f5-f931-4125-a5d1-7c1529554fbd

    Advanced REST Client plugin for Google Chrome

    As pointed out by Peter in the comments, there’s an awesome plugin for Chrome called Advanced REST Client which allows you to investigate the REST calls and configure your queries pretty simply through the UI. You get to see the results and the request times directly in the browser and you can play with the parameters etc easily until you get it just right. Great tip!

    chromerest

    Download: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US

    Postman – REST Client plugin for Google Chrome

    The previous REST Client I mentioned above is awesome, and here’s another really great tool that AC tipped us about. The Postman REST Client plugin for Google Chrome. Similar to the previous plugin for Chrome, but slightly different for the one who prefers that tool instead. An idea is to try them out both and figure out which one you like best yourself.

    image 

    Download: https://chrome.google.com/webstore/detail/postman-rest-client/fdmmgilgnpjigdojojpjoooidkmcomcm

    SharePoint 2013 Client Browser

    As pointed out in the comments by André, the SharePoint 2013 Client Browser is a tool similar to SharePoint Managed which I’ve mentioned above in this article. With this tool you can connect remotely to a SharePoint environment and investigate the data through the Client API’s. In my screenshot I’m connected from my laptop to my Office 365 SharePoint Online dev-account for Pointbird.com development. Pretty sweet!

    image

  • Download: https://spcb.codeplex.com/

    Note: There’s a similar tool available called SharePoint Explorer 365, which also allows for connecting to Office 365 which can be found here (http://sharepointrepairjoint.blogspot.com.au/2012/05/sharepoint-explorer-365.html). I prefer the previously mentioned one though, the SharePoint 2013 Client Browser, but that’s a matter of preference.

    smtp4dev

    I can’t believe I originally forgot to put this in. Thanks to the tip in the comments from Caroline I got around to add it to the list here. Smtp4dev is an awesome tool for testing out if SharePoint are sending its e-mails properly, but instead of actually sending the e-mails to the recipients (which may not be wanted if you’re testing on real data for example..) it will catch all e-mails sent through the smtp server and allow you to view them directly in the tool’s UI. It’s pretty neat, and I do use it a lot when working with things related to e-mails and specifically automated processes where e-mails may be sent at various points in time but you still need to verify the logic and correctness.

    image

    Download: http://smtp4dev.codeplex.com/

    Summary

    So there you go. For everyone who asked what common tools I keep in my toolbox; There’s the most common ones.

    If I missed to mention a tool, feel free to enlighten me and perhaps I can add it to the post.

    Enjoy.

    Author: Tobias Zimmergren
    http://www.zimmergren.net | http://www.tozit.com | @zimmergren

    Introduction

    Some exiting news is about to be published and I’m glad to announce that some fantastic plans we’re working on is about to take shape. As stated in the headline of this post, TOZIT AB is now hiring staff in Sweden. We’re looking for sales representatives, consultants and helpdesk colleagues.

    TOZIT AB is located in Sweden with it’s main office in Malmö, and operates a lot in Stockholm. The persons we’re looking for initially should be able to work either in Malmö/Öresundsregionen or Stockholm.

    At TOZIT we are always looking to deliver high quality projects and resources, but not without having a great time doing so. The first and foremost policy we’ve got is to enjoy every day you work with us.

    We invest in our employees making sure they are top of the line and always up to date with what’s new in the SharePoint world. By joining TOZIT AB, we will make sure that you get the latest and greatest training to make sure you’re on top of the latest technology.

    #1: SharePoint specialist

    If you’re aspiring to be a solid SharePoint professional and want to work together with some of the brightest minds when it comes to .NET and SharePoint, this is an opportunity you don’t want to miss out on.

    Job Requirements

    • Basic understanding of SharePoint infrastructure, design and development.
    • Additional merits include:
      • Real world SharePoint project experience
      • .NET development experience
      • .NET and SharePoint Certifications (MCP, MCPD, MCITP, MCTS, MCT, …)

    Job Location

    This job opening applies to people able to work in one of the following locations:

    • Stockholm
    • Malmö/Köpenhamn/Öresundsregionen

    Application Details

    Please send your application to jobs@tozit.com if you’re interested in learning more about this position and what we can offer you. Please attach your updated resume (CV) along with any additional data (LinkedIn profile for example).

    #2: Senior SharePoint specialist

    If you’re a senior SharePoint professional looking for new challenges, perhaps we could fit you in our team.

    In this role we will expect you to have a vast experience from the field as a consultant or freelancer and have been working with a lot of real world projects that you can showcase or talk about.

    Job Requirements

    • 4+ years of experience with professional SharePoint projects
    • Additional merits include:
      • .NET development
      • Certifications (MCP, MCPD, MCITP, MCTS, MCT, …)

    Job Location

    This job opening applies to people able to work in one of the following locations:

    • Stockholm
    • Malmö/Köpenhamn/Öresundsregionen

    Application Details

    Please send your application to jobs@tozit.com if you’re interested in learning more about this position and what we can offer you. Please attach your updated resume (CV) along with any additional data (LinkedIn profile for example).

    #3: Technical helpdesk

    We’re currently also looking for someone to work with support and helpdesk, where your main responsibility will be to make sure the internal systems work properly and assist the different departments in their daily routines.

    Job Requirements

    • You should most definitely be service minded
    • A technical background with Microsoft technologies is preferred

    Job Location

    This job opening applies to people able to work in central Stockholm only.

    Application Details

    Please send your application to jobs@tozit.com if you’re interested in learning more about this position and what we can offer you. Please attach your updated resume (CV) along with any additional data (LinkedIn profile for example).

    #4: SharePoint sales representative

    We’re looking to extend our sales team with one or more additional resources to help out and assist in the sales and finding new leads on projects, and help close new deals with new and existing customers.

    Job Requirements

    You’re a sales representative with focus on quality instead of quantity and knows how to listen to the clients requirements and can match that with what we can offer. You should have a network to utilize for finding new projects and clients and being able to find new leads.

    Job Location

    • Malmö (with the possibility to work in Stockholm sometimes)

    Application Details

    Please send your application to jobs@tozit.com if you’re interested in learning more about this position and what we can offer you. Please attach your updated resume (CV) along with any additional data (LinkedIn profile for example).

    Summary

    We’re looking to extend our team and the level of services we provide by employing some new colleagues to work with us in our awesome team. If you’d like to work with me and my team and want to have fun while doing so, please don’t hesitate to send your application to us :-)

    CKS : Developer Tools – A tool for your toolbox

    August 11th, 2010 by Tobias Zimmergren

    Author: Tobias Zimmergren
    http://www.zimmergren.net | http://www.tozit.com | @zimmergren

    Introduction

    If you’re a seasoned SharePoint developer, you probably have a good set of tools that you’re working with on a daily basis. Some of my all-time favorites include:

    With the addition of new tools to the community basically every week, it could be hard to keep track of all the different extra applications you’d want to use.

    CKS:Dev has been released!

    If you’ve heard of CKS before (Community Kit for SharePoint), you might know that there’s great support for Blogs (EBE) and other cool things. Actually, this blog is based on the CKS:EBE code. Works like a charm!

    Now, if you’ve missed it – there’s a new addition to the CKS-family called the CKS: Developer Tools which is essentially extending the functionality in Visual Studio 2010.

    There’s currently two versions released. One for SharePoint Foundation 2010 and one for SharePoint Server 2010.

    You can find them here:

    What’s in it for me (the developer)?

    There’s some really superb additions to Visual Studio 2010 when installing the aforementioned versions of the CKS:Dev project. These include some of my favorites:

    • SharePoint Tab in the References dialog (no need to goof around the filesystem to find the dll’s)
    • Extended SharePoint Explorer
      • See more libraries
      • Activate/Deactivate features directly from the explorer
      • Enable/Disable the Developer Dashboard (yay!)
      • Generate Entity Classes (finally!)
      • <a lot more, but those were my favorites>
    • A bunch of new cool project templates, including some of these jolly good jewels:
      • Basic page
      • Delegate control
      • Master page
      • Custom Action, Custom Action Group, Hide Custom Action (good stuff)
      • Sandbox Full Trust Proxy
      • <the list continues..>
    • Quick Deployment steps
      • Easily deploy your code and files quickly with the WSPBuilder-alike commands like:
        • “Copy to SharePointRoot”
        • “Copy to Bin”
        • “Copy to GAC”
        • “Recycle App Pools”
        • “Attach to worker process”
        • and so on.

    Aside from the aforementioned awesomeness, there’s a whole lot of other stuff that I bet I’ve missed out on with this tool. I’d say go and find out yourself if you haven’t already – you  will not want to work without this in your toolset ever again, of that you can be sure!

    Summary

    The reason for posting some info and selling-points behind the (free) developer tools from the CKS team are foremost that when I’m doing training or when I’m supporting clients in different projects, they always asks me what tools they should have in their toolbox.

    I’m surprised that not even 20% of them knows about the CKS:Dev extensions. So with this post I’m hoping to enlighten some of those folks.

    Enjoy!

    Visual Studio 2010 SharePoint Power Tools – Released

    June 18th, 2010 by Tobias Zimmergren

    Author: Tobias Zimmergren
    http://www.zimmergren.net | http://www.tozit.com | @zimmergren

    Introduction

    Our good friend Mike Morton over at Microsoft just announced the official release of some great extensions to Visual Studio 2010, called SharePoint Power Tools.

    These tools will extend Visual Studio 2010 to give your these additional features:

    • Sandboxed Visual Web Part
    • Compile-time warnings on Sandboxed solutions when trying to use disallowed code

    Download

    http://visualstudiogallery.msdn.microsoft.com/en-us/8e602a8c-6714-4549-9e95-f3700344b0d9

    WSPBuilder – Walkthrough of the Visual Studio Add-in

    April 8th, 2009 by Tobias Zimmergren

    Author: Tobias Zimmergren
    http://www.zimmergren.net

    Introduction

    Alright. People have approached me lately and asked me if I could give them a brief introduction to the WSPBuilder extensions available for Visual Studio. Instead of taking all those discussions on one by one, I’ve decided to document some of the main features here. If I’m missing out on something, please let me know and I’ll fill it up.

    Bil Simser did a survey with the SharePoint MVP’s and summarized the foremost favorite CodePlex projects in this article. 

    In this article I will cover one of my favorite tools – WSPBuilder.

    WSPBuilder background

    A SharePoint Solution Package (WSP) creation tool for WSS 3.0 & MOSS 2007
    No more manually creating the manifest.xml file
    No more manually specifying the DDF file
    No more using the makecab.exe application

    Carsten Keutmann, an MVP and friend in Copenhagen is the brilliant mind behind this awesome application.

    The idea behind the WSPBuilder add-in for Visual Studio is that it’s based on any normal "Class library" template – which means that you can easily copy your entire WSPBuilder project to a machine that doesn’t have WSPBuilder and still be able to open the project. – This is something you can’t do with a lot of other extension tools (say, the VSeWSS for example)

    WSPBuilder Installation

    Just download the latest release of the "WSPBuilder Extensions – Visual Studio Addin" and let the installation guide take you through the most simple process ever – clickety click.

    Creating a WSPBuilder project

    When you have installed the add-in to Visual Studio, you should now be able to create a new project based on the "WSPBuilder" template.

    To kick this off, let’s create our WSPBuilder project:
    image

    Note: You don’t have to create a WSPBuilder template, you can create a normal Class Library as well. The only thing about a WSPBuilder template is that it will automatically create the "12" folder along with a temporary strong-key so you don’t have to do that right now.

    When you’ve created the project, you’ll see a structure like this one in your solution explorer:
     image

    The WSPBuilder will create the 12-folder, since it’s good practice to start your projects from the 12-root. It will also add the file "solutionid.txt" which contains a GUID to be used on the .wsp package, for easy reference. You will also get a strong-key generated for you so you don’t have to worry about signing your project right now.

    Alright, now that we’re up and running with a blank WSPBuilder project – we should start by adding something to the solution.

    WSPBuilder Templates – Overview

    In an ordinary fashion, right click on the project and choose Add – New item.
    image

    Choose the "WSPBuilder" node and you will see an overview over the available templates like this:
    image

    Let’s walk through each and every one of them! The joy! :-)

    Blank Feature Template Overview

    A blank feature does exactly what the name implies, it creates a blank feature for you!

    I’m creating a blank feature, and naming it to "BlankFeature1" so we easily can distinguish it from the other folders created later on.

    With WSPBuilder, when you create a new item based on a template, you’ll get a dialog asking you for some variables – and since this is a feature, it’s going to need a Title, Description and of course a Scope:
    image

    Your solution tree will be populated with a few new things, in this case the BlankFeature1 that we chose to create:
    image

    As you will see, you get not only the perfectly correct 12-hive structure – you will also get the feature.xml and elements.xml files created for you, and the feature.xml file can look like this:

    <?xml version="1.0" encoding="utf-8"?>
    <Feature  Id="8e039720-d7df-460a-8d65-c52e47417fdf"
              Title="BlankFeature1"
              Description="Awesome description for BlankFeature1"
              Version="12.0.0.0"
              Hidden="FALSE"
              Scope="Web"
              DefaultResourceFile="core"
              xmlns="http://schemas.microsoft.com/sharepoint/">
      <ElementManifests>
        <ElementManifest Location="elements.xml"/>   
      </ElementManifests>
    </Feature>

    Event Handler Template Overview

    With the Event Handler item template, you will not only get the correct 12-structure in your solution – you will also get the reference to "Microsoft.SharePoint.dll" added automatically, since an event handler requires some talking to the SharePoint Object Model.

    We will get our feature.xml and elements.xml as normal – but this time the elements.xml is pre-populated with some tags to hook up our event handler:

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Receivers ListTemplateId="100">
        <Receiver>
          <Name>AddingEventHandler</Name>
          <Type>ItemAdding</Type>
          <SequenceNumber>10000</SequenceNumber>
          <Assembly>Zimmergren.SharePoint.Demo.WSPBuilder, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b7201b5590fd1fc0</Assembly>
          <Class>Zimmergren.SharePoint.Demo.WSPBuilder.EventHandler1</Class>
          <Data></Data>
          <Filter></Filter>
        </Receiver>
      </Receivers>
    </Elements>

    As you can see, the elements.xml file is referring to the assembly called Zimmergren.SharePoint.Demo.WSPBuilder and a class called EventHandler1.

    With the magic of WSPBuilder, this class has of course also been created for us and will look something similar to this:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SharePoint;

    namespace Zimmergren.SharePoint.Demo.WSPBuilder
    {
        class EventHandler1 : SPItemEventReceiver
        {
            public override void ItemAdded(SPItemEventProperties properties)
            {
                base.ItemAdded(properties);
            } 

            public override void ItemAdding(SPItemEventProperties properties)
            {
                base.ItemAdding(properties);
            } 

            public override void ItemUpdated(SPItemEventProperties properties)
            {
                base.ItemUpdated(properties);
            } 

            public override void ItemUpdating(SPItemEventProperties properties)
            {
                base.ItemUpdating(properties);
            } 
        }
    }

    Solution Installer Configuration

    If you’ve ever used the SharePoint Installer from CodePlex, you know that when you want to use it with your own .wsp file you need to do some adjustments to the configuration xml.

    With the Solution Installer Configuration template you will get this configuration automatically created and hooked up with your project. The Setup.exe.config file might look like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <appSettings>
        <add key="BannerImage" value="Default"/>
        <add key="LogoImage" value="None"/>
        <add key="EULA" value="EULA.rtf"/>
        <add key="SolutionId" value="6e23b11d-8460-49a0-b2f1-b8aa78d7c58d"/>
        <add key="FarmFeatureId" value="bb1586eb-3427-483b-baa5-ae5498c47d69"/>
        <add key="SolutionFile" value="Zimmergren.SharePoint.Demo.WSPBuilder.wsp"/>
        <add key="SolutionTitle" value="Zimmergren.SharePoint.Demo.WSPBuilder"/>
        <add key="SolutionVersion" value="1.0.0.0"/>
        <add key="UpgradeDescription" value="Upgrades {SolutionTitle} on all frontend web servers in the SharePoint farm."/>
        <add key="RequireDeploymentToCentralAdminWebApplication" value="true"/>
        <add key="RequireDeploymentToAllContentWebApplications" value="false"/>   
      </appSettings>
    </configuration>

    Web Part Feature

    This is by far one of the most popular templates, as it crates a generic template for your web part and also creates the feature for provisioning the Web Part to the Web Part Gallery.

    You will get the elements.xml file configured something like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <Module Name="WebPartPopulation" Url="_catalogs/wp" RootWebOnly="TRUE">
        <File Url="WebPartFeature1.webpart" Type="GhostableInLibrary">
          <Property Name="Group" Value="MyGroup"></Property>
          <Property Name="QuickAddGroups" Value="MyGroup" />
        </File>
      </Module>
    </Elements>

    and you’ll get the required .webpart file configured something like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <webParts>
      <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
        <metaData>
          <type
            name="Zimmergren.SharePoint.Demo.WSPBuilder.WebPartFeature1,
            Zimmergren.SharePoint.Demo.WSPBuilder,
            Version=1.0.0.0,
            Culture=neutral,
            PublicKeyToken=b7201b5590fd1fc0" />
          <importErrorMessage>
                Cannot import WebPartFeature1 Web Part.
          </importErrorMessage>
        </metaData>
        <data>
          <properties>
            <property name="Title" type="string">WebPartFeature1</property>
            <property name="Description" type="string">
                Description for WebPartFeature1
            </property>
          </properties>
        </data>
      </webPart>
    </webParts>

    and you will get the WebPartFeature1.cs file created automatically (or whatever you choose to name it) and it usually look like this:

    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
    using System.Web.UI;
    using System.Web.UI.WebControls.WebParts;

    namespace Zimmergren.SharePoint.Demo.WSPBuilder
    {
        [Guid("a043d73d-7418-4918-baed-828a2bc77019")]
        public class WebPartFeature1 : Microsoft.SharePoint.WebPartPages.WebPart
        {
            private bool _error = false;
            private string _myProperty = null; 

            [Personalizable(PersonalizationScope.Shared)]
            [WebBrowsable(true)]
            [System.ComponentModel.Category("My Property Group")]
            [WebDisplayName("MyProperty")]
            [WebDescription("Meaningless Property")]
            public string MyProperty
            {
                get
                {
                    if (_myProperty == null)
                    {
                        _myProperty = "Hello SharePoint";
                    }
                    return _myProperty;
                }
                set { _myProperty = value; }
            } 

            public WebPartFeature1()
            {
                this.ExportMode = WebPartExportMode.All;
            } 

            /// <summary>
            /// Create all your controls here for rendering.
            /// Try to avoid using the RenderWebPart() method.
            /// </summary>
            protected override void CreateChildControls()
            {
                if (!_error)
                {
                    try
                    { 

                        base.CreateChildControls(); 

                        // Your code here…
                        this.Controls.Add(new LiteralControl(this.MyProperty));
                    }
                    catch (Exception ex)
                    {
                        HandleException(ex);
                    }
                }
            } 

            /// <summary>
            /// Ensures that the CreateChildControls() is called before events.
            /// Use CreateChildControls() to create your controls.
            /// </summary>
            /// <param name="e"></param>
            protected override void OnLoad(EventArgs e)
            {
                if (!_error)
                {
                    try
                    {
                        base.OnLoad(e);
                        this.EnsureChildControls(); 

                        // Your code here…
                    }
                    catch (Exception ex)
                    {
                        HandleException(ex);
                    }
                }
            } 

            /// <summary>
            /// Clear all child controls and add an error message for display.
            /// </summary>
            /// <param name="ex"></param>
            private void HandleException(Exception ex)
            {
                this._error = true;
                this.Controls.Clear();
                this.Controls.Add(new LiteralControl(ex.Message));
            }
        }
    }

    Web Service Template

    The following files will be automatically created for you:

    • 12LAYOUTSWebService1.asmx
    • WebServiceCodeWebService1.cs

    WebService1.asmx may look like this:

    <%@ WebService Language="C#"
    Class="Zimmergren.SharePoint.Demo.WSPBuilder.WebService1,
    Zimmergren.SharePoint.Demo.WSPBuilder,
    Version=1.0.0.0,
    Culture=neutral,
    PublicKeyToken=b7201b5590fd1fc0"  %>

    WebService1.cs may look like this:

    using System;
    using System.Web;
    using System.Web.Services;
    using System.Web.Services.Protocols;

    namespace Zimmergren.SharePoint.Demo.WSPBuilder
    {
        [WebService(Namespace = "http://schemas.microsoft.com/sharepoint/">
      <ElementManifests>
        <ElementManifest Location="elements.xml"/>
      </ElementManifests>
    </Feature>

    FeatureWithReceiver1.cs might look like this:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using Microsoft.SharePoint;

    namespace Zimmergren.SharePoint.Demo.WSPBuilder
    {
        class FeatureWithReceiver1 : SPFeatureReceiver
        {
            public override void FeatureActivated(SPFeatureReceiverProperties properties)
            {
                throw new Exception("The method or operation is not implemented.");
            } 

            public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
            {
                throw new Exception("The method or operation is not implemented.");
            } 

            public override void FeatureInstalled(SPFeatureReceiverProperties properties)
            {
                throw new Exception("The method or operation is not implemented.");
            } 

            public override void FeatureUninstalling(SPFeatureReceiverProperties properties)
            {
                throw new Exception("The method or operation is not implemented.");
            }
        }
    }

    Sequential Workflow Feature and State Machine Workflow Feature Templates

    Creates the necessary files to get started with your Sequential Workflow code.

    • 12TEMPLATESequentialWorkflowFeature1elements.xml
    • 12TEMPLATESequentialWorkflowFeature1feature.xml
    • WorkflowCodeSequentialWorkflowFeature1.cs
    • WorkflowCodeSequentialWorkflowFeature1.designer.cs

    The same routine applies to the State Machine Workflow Feature template.

     

    Web Part Without Feature

    Finally, you can create a Web Part without the feature – basically just creating the .webpart file and the .cs file.

    • 80wpcatalogWebPart1.webpart
    • WebPartCodeWebPart1.cs

    Solution tree overview

    Since I’ve been bashing all kinds of templates in here, you’ll see that there’s a huge tree of files – all automatically created in less than 1 minute.

    image

    Template Overview Summary

    Alright, the templates I’ve been mentioning before are great to get rolling with a new SharePoint project. But what about deployment of this solution? How do we create our .wsp file, and how do we choose where the files should land (Global Assembly Cache – GAC – or the /bin folder?)

    That’s what the next section is all about – bringing some clarification to how the WSPBuilder creates your packages.

    WSP Creation and Deployment with WSPBuilder

    So, when we’re satisfied with our awesome project and want to build a .wsp package from it – we can simply choose to right click the project -> WSPBuilder -> Build WSP and it will automatically create the .wsp for us:
    image

    This will create a .wsp file in your project folder like so:
    image

    Now, if you want to check the contents of the .wsp package, you simply rename the .wsp file to .cab and open it, like so:
    image

    Manifest.xml

    In the cabinet (.wsp package) you will find the file called Manifest.xml - this is the file that tells SharePoint where to actually deploy the solution – GAC or BIN.

    If you don’t do any changes at all, this file will look something like this:
    image

    As you can see, the DeploymentTarget is set to "GlobalAssemblyCache"  and your dll will go into the GAC.

    Now, in this particular case we can not deploy to the /bin folder anyway – as we have types in our assembly that MUST go into the GAC (Workflows and EventReceivers are two of those types).

    But if we were to have a Web Part project or what not – and we want to deploy it only to the /bin folder, follow along with the next few steps.

    Scoping the assembly for BIN instead of GAC (including Code Access Security generation)

    Okay. So you don’t want it in the GAC, but in your BIN folder instead. That’s okay, just follow along with these few simple steps:

    • Remove your /bin/debug folder entirely from your solution (make sure the .dll gets wiped)
    • If the 80-folder in your project root isn’t created – create it
      • Create a folder called "bin" folder in the 80 folder
      • Your solution tree should look something similar to this:
        image
      • Right click your project and choose "Properties"
      • Choose the "Build" tab
      • Change the Output path from "binDebug" to "80bin":
        image

    When you build your project now, your .dll should pop into the "80bin" folder in your solution tree like this:
    image

    Ready to Rock – Scoping the assembly for the /bin folder

    If we go about building our .WSP package again (right click project – WSPBuilder – Build WSP) and rename the .wsp to .cab and check the manifest.xml file – we should see two things done different:

    • DeploymentTarget is set to WebApplication (any chosen WebApp, e.g. /bin)
      image
    • Some general CAS (Code Access Security) permissions has been automatically added to make your assembly run:
      image

    Deployment with WSPBuilder

    Okay. So we’ve created our project, scoped it either for GAC (do nothing) or for /bin (make the changes in the previous section) – and we want to deploy it. What do we do?

    • Right Click the Project -> WSPBuilder -> Deploy
      Your output window will show something like this:
      image

    Check your Solution Management in Central Administration under the tab "Operations" and make sure it’s successfully deployed:
    image

    Conclusion and Summary

    This post simply walks through some of the more popular features of the WSPBuilder created by my pal Carsten Keutmann in Copenhagen.

    If there’s any questions or comments – please add them in the comments section below.

    Thanks

    VSeWSS v1.3 – Feb 2009 CTP released

    February 21st, 2009 by Tobias Zimmergren

    As I know this is a popular tool for some of you guys reading this blog (I’ll leave my own comments on the tool unsaid for now) – you can now download the latest February CTP from the Microsoft Download site.

    VSeWSS 1.3 February 2009 CTP has been released, go on and grab it here: Visual Studio 2008 Extensions for Windows SharePoint Services 3.0, v1.3 – Feb 2009 CTP

    Some of the highlighted features include, but are not limited to:

    • Can be installed on x64 Server OS machines running SharePoint x64. Previously only x86 Server OS could be used
    • Separate build commands for package, deploy and retract are added as Visual Studio menu items
    • WSP View improvements for consistency of deleting feature elements, merging features and adding event receivers to features
    • Command line build, package and retract commands are included enabling continuous integration and build servers. Previously command line build of SharePoint projects was very difficult
    • Refactoring support for renaming of Web Parts. Previously renaming a web part required changes in several files in the project
    • Solution Generator can now generate solutions from publishing sites. Previously only regular sites could be generated
    • Allowing partial trust BIN deployments of web parts
    • New project item template for SharePoint RootFiles items
    • Deployment will now optionally remove conflicting existing features on the development server prior to redeployment. Previously any feature name conflicts would result in an error
    • Ancillary assemblies such as for business logic can now be added to the SharePoint Solution WSP
    • Hidden features related to Site Definition projects are now shown in WSP View. They are no longer hidden
    • For advanced users a fast deploy is included to update only the compiled assembly on the SharePoint development installation
    • Deployment step logging is included
    • The List Definition from Content Type template now allows for the creation of a List Definition Event Receiver
    • The User Guide is now installed with the extensions instead of being a separate download

    Note: This release is not officially supported by Microsoft (Being a CTP), so if you bump into trouble – you don’t really have any official support from Microsoft on your related issues.

    Technorati Tags: ,,