#SP24 slides and video “Developing high quality SharePoint solutions/apps with SPCAF”

After organizing SP24 on 16th/17th of April and SP24 Rewound 5 weeks later, we are finally done! :)

And I have to say, not without some pride, that we have exceeded our own expectations with a whooping 7500 attendees making SP24 the second biggest SharePoint Conference worldwide after SPC :)

I am planning to write a blog post about our 10month journey making all of this happen but for now, I leave you with my own session slides and video about using SPCAF to quality check your custom solutions and apps.

You can get a free trial here!

All other 98 sessions you don’t want to miss are available for FREE on-demand for registered users at www.sp24conf.com.

Developing high quality SharePoint solutions/apps with SPCAF

Abstract:

SharePoint development and fun do not always have much in common! Everyone who has ever developed for SharePoint in Visual Studio might know what I mean. Even a small SharePoint solution consist already of a large amount of different files (xml, cs, js, css, resx, jpg, aspx, etc) which may be structured differently depending on the preferences and experience of the developer.

Particularly the extensive XML Schema for manifest.xml, feature.xml, element.xml, Content Types, List Definitions, etc. is an endless source of surprise and cannot be debugged at all in Visual Studio.

As a way out, many developers choose to develop standard SharePoint artefacts programmatically rather than following the declarative approach which make the solutions even more complex.
As a result it is really hard to analyze SharePoint solutions, find violations against the XML schema, best practices, coding guidelines or to pinpoint performance sinks and cyclomatic dependencies of artefacts. Neither Visual Studio nor other tools like FXCop, StyleCop etc. allow to perform SharePoint specific automatic code analysis.

This session will show the SharePoint code analysis framework (SPCAF) available at www.spcaf.com which addresses exactly this gap and you will learn how to easily develop your own rules for it.

Thanks to all attendees, speakers, anchors, sponsors and team who have participated in this great adventure!
More to come! :)
Here is a list of all other sessions of SP24

Sessions and slides from the #ESPC14

This week I was attending and speaking at the European SharePoint Conference in Barcelona and it was just great!
To sum it up quickly great city, many interesting sessions, great food and awesome people :)

I want to thank everyone who attended my session for the great feedback. Seems like you learned something new and had some fun too! So did I :)

I had two sessions, both on the last day of the conference.

SharePoint Apps, Past, Present, Future, an Open Discussion Board

Together with Rodrigo PintoChris O’BrienJeremy Thake , Thorsten HansRadi Atanassov and Adis Jugo I sat on the podium to discuss our experiences and the challenges with the new way of developing for SharePoint, Office and Office365.

It was fun and interesting to hear the different views and also to hear the questions and concerns from the audience. I hope everyone got something out of it and will take the new app model and ways to implement solutions at least into consideration for the next projects. The earlier you do, the better you are prepared for the future versions of SharePoint and Office.

Jeremy recorded the whole discussion and will publish it soon on his new pod show. I will update this post as soon as it is available.

SharePoint Continuous Integration With VSOnline & Azure

I have been speaking on many conferences and user groups about Application Lifecycle Management for SharePoint over the last 6 years, but the topic never gets old :)

Compared to when I started speaking about this topic a lot of things in SharePoint ALM world changed and improved of course, but the ALM maturity in many SharePoint teams and projects still seems to be at the beginning (at least most can now claim that they have source control, Yay! ;) )

This time I focussed entirely on the continuous integration and deployment process and showed how you can automatically build, quality check (of course with my own SharePoint Code Analysis Framework SPCAF) and deploy SharePoint farm/sandboxed solutions and apps.

Although I explained during the session the automatic deployment/staging with Visual Studio Online (formerly known as Team Foundation Service), virtual machines running on Microsoft Azure (formerly known as Windows Azure) and SharePoint online (also known as Office365), the same process can be easily implemented with on-premises Team Foundation Server and SharePoint. I just wanted to include as many buzzwords as possible in my session :)

Anyway it is just soooo much simpler and quicker to get everything up and running with the cloud services compared to their on-prem counterparts.

As mentioned in my talk, I simply created a new build process template for Chris O’Brien’s SharePoint/TFS Continuous Integration Starter Pack in order to support Git projects in Visual Studio online. The included actions will pass the configured target server and the drop location to the specified script.

GITSPFarmSolutionCOBCDTemplate

The template is not limited to that though. You can basically run any type of PowerShell Script after the successful build. It just needs to be stored either locally on the build controller or in source control. As the hosted build controller provided in VSO does not have PowerShell remoting access to any of your target environments this works of course only with a custom build controller.

You can download the ProcessTemplate and the slightly updated “MasterBuildScript.ps1″ from here. You can use it together with the SharePoint/TFS Continuous Integration Starter Pack.

I also showed a more complex, yet way more powerful continuous deployment process, which does not require any script to be placed on the servers and will take everything from the drop location instead, integrating my own SharePoint Solution Deployer PowerShell script available on CodePlex. I am going to package the CI/CD components for the next release and post a blog here explaining everything in detail how to set it up.

Last but not least the walkthrough how to setup continuous deployment for Provider hosted apps from VSO to MS Azure and SharePoint Online is described in great detail on Kirk Evan’s blog.

So long, and without further ado, here come the slides.

Abstract:
With the Cloud Services Azure and VSOnline professional SharePoint Development has never been easier. Having the infrastructure available on demand and only paying per use allows you to build complete production-like SharePoint farms in no time at minimal costs. VS Online on the other hand provides everything you need to develop projects alone or in a team. SourceControl, WorkItems, TeamBuild, Automated Testing including the traceability of all of it and detailed reporting. Even better, with an MSDN subscription both VS Online and Azure is already included. This session explains the important bits about setting up your SharePoint farm(s) on Azure, using VSOnline to automatically build your SharePoint solution or app and what you need to automatically stage the build to your farm or SharePoint Online.

 

I’m Speaking at the European SharePoint Conference 2014

espc_badgeThe European SharePoint Conference is less than two weeks away and I’m delighted to be part of such an exceptional line up.

The conference will take place in Barcelona, Spain from the 5-8th May 2014 and is Europe’s largest SharePoint event bringing you great sessions and the latest innovations from Vegas.

Browse through the superb conference programme including 110 sessions, keynotes, and tutorials, including topics covering the latest news from SPC14 including what’s new with SharePoint 2013 SP1 – Office Graph/Oslo – new Office 365 REST APIs – Access Apps – Cloud Business Apps.

I will be conducting a session on

SharePoint Continuous Integration With TFS Online & Azure VMs

With the Cloud Services Azure and TFS Online professional SharePoint Development has never been easier. Having the infrastructure available on demand and only paying per use allows you to build complete production-like SharePoint farms in no time at minimal costs. TFS Online on the other hand provides everything you need to develop projects alone or in a team. SourceControl, WorkItems, TeamBuild, Automated Testing including the traceability of all of it and detailed reporting. Even better, with an MSDN subscription both TFS Online and Azure is already included. This session explains the important bits about setting up your SharePoint farm(s) on Azure, using TFS Online to automatically build your SharePoint Project and what you need to automatically stage the build to your farm.

The European SharePoint Conference will be run over four days and with over 1000 SharePoint attendee’s already signed up don’t miss this fantastic opportunity to mingle with the European SharePoint Community.

If you want to deepen your SharePoint expertise, to understand the trend of the SharePoint market, and to learn how to leverage Microsoft Office 365 for your business, including the revolutionary Enterprise Social wave, the European SharePoint Conference is the best place to be in 2014!

See you in Barcelona in May!

If you like to talk with me in Barcelona about SPCAF or just want to grab some awesome SPCop/SPDepend/SPMetric or SPInventory stickers, then drop me a line on the contact page or tweet me during the conference :)

Win free SPCAF licenses!

To celebrate the latest SPCAF release 4.5.2. and the availability of SPCop, SPDepend, SPMetrics and SPInventory as separate products my company Rencore is giving away

  • 1 x SPCAF Professional
  • 1 x SPCop Developer Edition
  • 1 x SPDepend
  • 1 x SPMetrics Developer Edition
  • 1 x SPInventory Developer Edition

altogether worth over

$7,700.00

So what are you waiting for, enter the raffle now!

Disclaimer: Each license is the full version of the product and valid for one year. After that the winners can continue using SPCAF by purchasing the annual Software Assurance.

a Rafflecopter giveaway

Building your own extension for SPSD

SharePoint Solution Deployer (SPSD) has grown to a quite big script and even though it supported custom targets/events from the beginning, it was fairly difficult to update SPSD and also re-use your custom PowerShell commands without intensive testing.

The new extension system introduced with the recently released SPSD5 solves these problems.

What is an extension?

Basically everything that SPSD does not out of the box during the deployment process.

An extension could be for example:

  • a simple script to change some farm settings
  • creating webapplications or site structures
  • activate features
  • set permissions
  • create/import demo content
  • create service applications
  • configure the farm
  • import managed metadata
  • etc….

Extensions can be registered with different functions for multiple events i.e. Initialize, BeforeDeploy, AfterRetract etc.

Following extensions are already work in progress and will be released in the next couple of weeks:

  • SiteStructure: Create Site Collections (optional with custom ContentDB), subsites, assign permissions
  • ContentTypeHub: Create/Remove and configure ContentTypeHub
  • ManagedMetadata: Backup and Restore Managed Metadata Termsets and MMS configuration, including custom properties and multilingual lables/descriptions
  • LoggingConfiguration: Creates/Removes logging areas and categories based on SP Guidance logging
  • several more simple extensions like “SetMaximumFileSize”, “SetBlockedFileExtensions” etc.

So stay tuned :)

The big advantage about the extensions is that they can be updated independently of SPSD.

Additionally this allows you  to re-use the extension in several projects.

I plan to add the extensions to the Technet galleries with the tag “SPSD” so that people can vote and comment on them. If you like to publish your own extension then it would be great if you do the same to make them easy findable.

You are also welcome to modify and re-publish extensions if you have improved them or found a better approach.

How to create an extension?

Extensions are very easy to create.

They consist of

  • extension folder in the Scripts/Extensions folder which
    • must have a manifest.xml file, letting SPSD know that the extension exists
    • a .ps1 file with your custom PowerShell commands (see Example.ps1)
  • extension configuration file in the SPSD/Environments folder
    or a section in an existing environment file (see Environments/Example.xml) which tells SPSD which custom PS function it should run during which deployment step.

Manifest

The manifest file is stored in the folder /Scripts/Extensions/<extensionname>  and defines

  • the extension type (a unique type to identify the extensions),
  • the version
  • the associated script file and
  • if the extension is currently enabled or disabled
<?xml version="1.0" encoding="utf-8" ?>
<SPSD>
  <Extensions>
    <Extension>
        <Manifest>
            <Type>Example</Type>
            <Description>
                This is an example to show how the SPSD extensions system is working.              
            </Description>
            <Version>1.0.0.0</Version>
            <Script>Example.ps1</Script>
            <Enabled>true</Enabled>
        </Manifest>
    </Extension>
   </Extensions>
</SPSD>

By specifying the manifest, SPSD can automatically pick up your extension and register it for deployment actions.
The extension will be loaded inline, which means that functions and variables of the extension script are not available after the extension is done.

This means that your extension cannot harm the rest of the execution of SPSD, but also that you cannot (and should not) pass information from one extension to another.

Also all disposable objects allocated in the extensions script will be automatically disposed  by SPSD when the extension is finished.

Script

To implement an extension script you just create a .ps1 file in the /Scripts/Extensions/<extensionname> folder and define a function with following parameters

  • $parameters : a collection of all named parameters defined in the extension configuration file
  • $data : the <Data></Data> node of the extension configuration file (see next section)
  • $extId : the extension Id as defined in the extension configuration file (manifest.xml)
  • $extensionPath : the path to this file, in case you require to load from other files in the extensions script folder

This could look like the following

function Execute-ExampleExtension($parameters, [System.Xml.XmlElement]$data, [string]$extId, [string]$extensionPath){
        Log -message "Parameters:" -indent -type $SPSD.LogTypes.Normal
            Log -message ("Parameter1: "+ $parameters["ExtensionParameter1"]) -type $SPSD.LogTypes.Normal
            Log -message ("Parameter2: "+ $parameters["ExtensionParameter2"]) -type $SPSD.LogTypes.Normal
        LogOutdent

        Log -message "Data:" -indent -type $SPSD.LogTypes.Normal
        foreach($node in $data.ChildNodes){
            Log -message ($node.Name + ": "+ $node.innerText) -type $SPSD.LogTypes.Normal
        }
        LogOutdent

        Log -message ("Extension ID: "+ $extId) -type $SPSD.LogTypes.Normal
        Log -message ("Extension path: "+ $extensionPath) -type $SPSD.LogTypes.Normal

        # implement your extension here    
    }

Note that this example is using the SPSD logging function. This assures that your extension output is not only printed out to the console but also is saved into the SPSD log file.

Environment Configuration

Although SPSD is now already picking up the extension and reading the manifest, you have to tell it on which deployment commands you like which function to be executed.

If you have used SPSD before, you know already about the environment files in the /Environments folder, which allow you to configure SPSD to your liking.

The following XML describes how an extension is configured.

<SPSD Version="5.0.3.6438">
  ... SPSD configuration ...
  <Extensions>
    <!-- This represents the extension configuration of the specific instance "ExampleInstance1" of-->
    <!-- the extension of type "ExampleExtension" -->
    <Extension ID="ExampleInstance1" Type="Example">
      <!-- Here you register the methods of your extension .ps1 file to one or several events -->
      <!-- You can also register multiple methods to the same event. -->
      <Events>
        <!-- This examples lists the available events -->
        <!-- The PowerShell function requires to accept the parameters as described in the Example.ps1 file -->
        <Event Name="BeforeDeploy">Execute-ExampleExtension</Event>
      <!--
        <Event Name="AfterDeploy"></Event>
        <Event Name="BeforeRetract"></Event>
        <Event Name="AfterRetract"></Event>
        <Event Name="BeforeUpdate"></Event>
        <Event Name="AfterUpdate"></Event>
        <Event Name="Initialize"></Event>
        <Event Name="Finalize"></Event>
        <Event Name="ProcessSolution"></Event>
        <Event Name="Preconditions"></Event>
       -->
      </Events>
      <!-- Here you can define parameter which are passed to the methods which are registered for SPSD events -->
      <!-- Each parameter is a key value pair -->
      <!-- You can also use SPSD variables here which will be resolved automatically on runtime -->
      <Parameters>
        <Parameter Name="ExtensionParameter1">$(UserID)</Parameter>
        <Parameter Name="ExtensionParameter2">Parameter</Parameter>
      </Parameters> 
      <!-- Here you can define you custom data XML structure which will be passed to the registered PowerShell functions -->
      <!-- You can also use SPSD variables which will be resolved automatically on runtime -->
      <Data>
        <ExampleNode>$(SiteUrl)</ExampleNode>
        <ExampleNode>Example</ExampleNode>
      </Data>
    </Extension>
  </Extensions>
</SPSD>

You can register your PowerShell function(s) to one ore multiple events and SPSD will pass the parameters and your custom xml data to them.

Available events are:

  • BeforeDeploy : Execute before the deployment tasks are started
  • AfterDeploy : Execute after the deployment tasks have finished
  • BeforeRetract : Execute before the retraction tasks are started
  • AfterRetract : Execute after the retraction tasks have finished
  • BeforeUpdate  : Execute before the update tasks are started (only when running “Update-SPSolution”)
  • AfterUpdate : Execute after the update tasks have finished (only when running “Update-SPSolution”)
  • Initialize : Executed after SPSD has initialized
  • Preconditions : Executed after SPSD has checked all pre-conditions. You can break the whole deployment by throwing a exception if your custom condition is not met.
  • Finalize : Executed after SPSD is done
  • ProcessSolution : Executed on every action happening to a specific solution (runs on deploy, retract and update for each WSP)

Tip: SPSD Environments files have also the ability to load any XML node from a separate file. So in order to keep your environment configuration nice and clean (and maybe re-use the extensions configuration for different environments) you should put it into a separate file and reference it.
A reference would look like this

<SPSD Version="5.0.3.6438">
  ...
  <Extensions>
    <Extension ID="ExampleInstance1" Type="Example" FilePath="Extensions\Example.xml" />
  </Extensions>
</SPSD>

The complete example extension is included in the current release and can also be downloaded separately from CodePlex.

How to test your extensions?

SPSD now has an additional batch file which starts the main script with the

  • DeploymentType = “Extensions” and the
  • DeploymentCommand = “Ask”

This means that when executing this batch, SPSD runs, but skips the actual deployment of the WSPs to speed up the process.

The “Ask” command results in SPSD asking you which deployment command you want to perform (Deploy, Retract, Redeploy, Update) before the script runs.

Summary

The new SPSD extension system allows you to build and re-use your custom scripts and integrate them with no effort into SPSD.
Migrating existing scripts is very easy by just providing a caller function which meets the extension requirements.

If you have new ideas for extensions please don’t hesitate to leave a comment here or on CodePlex!

In future posts I will explain how the extension system is actually built and also show off the extensions I have already built.

Until then feel free to check out the source code yourself :)