Thursday, 13 August 2015

Visual Studio 2015 Office Developer Tools automatically adds correct version of SharePoint client DLLs based on target SharePoint version


I recently installed Visual Studio 2015 and selected the Office developer tools feature as part of the install. Then I went about creating a sample SharePoint App project. The project creation wizard started with asking for SharePoint site and type of App

Next step required to specify the target SharePoint version. This step is newly added in Visual Studio 2015 and the target SharePoint version is auto selected based on the URL of the SharePoint site mentioned in previous step

As described  in the step Visual Studio 2015 Office Developer Tools adds correct reference to version SharePoint client DLL based on target SharePoint version.

If SharePoint 2013 was selected for target version then visual studio adds reference to version 15.0.0.0 of SharePoint.Client DLL

If SharePoint online was selected for target version then visual studio adds reference to version 16.1.3912.1204 of SharePoint.Client DLL

Friday, 31 July 2015

Could not load the assembly 'Microsoft.SharePoint,Version=16.0.0.0’ error when moving sites from Office 365 SharePoint Online to On Premise SharePoint 2013


Recently one of my clients who were using Office 365 SharePoint Online wanted to have a backup of their sites in their on-premise SharePoint environment. I used a leading SharePoint migration tool and was able to back up the sites to on premise SharePoint. But when trying to open a site or a document library I ran into the error “Could not load the assembly 'Microsoft.SharePoint,Version=16.0.0.0’”

The issue happened because Office 365 SharePoint Online is has been updated to version 16 of SharePoint DLL while the on-premise SharePoint 2013 server had version 15 of the DLL. All the pages for sites, libraries and lists were pointing to the version 16 of the DLL.

 If it was single page a quick fix would have been to open the page in SharePoint Designer and change the version of DLL to 15. But since there were many sites and sub sites with lots of libraries and list I wrote a PowerShell script(courtesy http://www.sharepointdiary.com/2013/02/create-update-copy-delete-views-powershell.html) to create new views for all lists and libraries and make them as default views. As the new view pages are referencing version 15 of Sharepoint the sites and libraries sprang back to life.