Wednesday, April 03, 2013

SharePoint Code Analysis Framework - Review

If you are a SharePoint  Administrator the tool Microsoft SharePoint Online Code Analysis Framework (MSOCAF) will be a very usefull to validate code from internal developers and solution from external companies and help you mantain a good SharePoint performance .
The Tool generates reports that you can send to the code  source owner  and tell them, that you don’t accept their solution in your environment  because don’t follow the best practices “same for Sandbox Solutions (is depreceated in 2013)”, since they have to install, they should also have the power to block the installation in the case the solution impacts the SharePoint performance.
This tool was created to validate code from SharePoint on-premise and Office 365 dedicated.

The first thing you should do is the MSOCAF installation.


The following prerequisites would be installed if not present on the system:
SharePoint 2010:
  • Windows Installer 3.1
  • .NET Framework 3.5 SP1
  • Microsoft SharePoint Server 2010

SharePoint 2013:
  • Windows Installer 3.1
  • .NET Framework 4.5 SP1
  • Microsoft SharePoint Server 2013
Install the software and open the Office 365 Code Analysis Framework.



Create the following Folder Structure in your Drive:


  • Root
    • Installation scripts
    • Release Documents
    • Solutions artifacts
    • Source code
    • Test documents


For this example I added a WSP solution example “Filter.wsp” in the folder Solutions Artifacts, the SharePoint Solution should be dropped here (Farm, sandbox, etc…).


After you add the solution return to the MSOCAF Solution Wizard and select “Next



The next window will give you the Tests and Rules the solution uses to validate the Solution code and configuration and click “Next”. There you selects the "Root" Folder that was created before and click "Analyze".


After you click Analyze, the solution starts to make the code validation of your solution. In the end a report will be generated with the results from the Code Validation.


You can also access to a Html/Excel Report in the Page to have a more detail and send to the Code owner for a review of their code.



Example of the report where you can  see all the details of the errors and the recommendations you should follow to correct.


One nice feature is the validation of the code for a upgrade to SharePoint 2013, you can also prevent possible issues for a Migration to the new Version.



Hope you can see the real potential of this tool in the validation and start to prepare a future migration of the SharePoint 2010 to SharePoint 2013 and also use  the new version.
Microsoft Documentation about this code validation:

PS: I recommend give a look in the project "SharePoint Code Analysis Framework (SPCAF) BETA" for code review, i will make a article about this solution.

Hope you like this article,
André Lage





Post a Comment