2015-05-01

Visual Studio allows developers to deploy/publish Apps to a site (site collection) which has been created using the ‘Developer Site Template’. Recently, I was working with a SharePoint 2013 App for one of my customers. The App was developed using Visual Studio 2013 and published on Developer Site Collection (On O365) to test the functionality.

However, I was getting this error while publishing the App through visual studio to my customers site :

“sideloading of apps is not enabled…”

Reason for this error?

Visual Studio calls the Microsoft.SharePoint.Client.AppCatalog.IsAppSideloadingEnabled method for the given site collection URL, which returns “true” if the site is a developer site or if the site has the sideloading feature enabled. To publish to a Site Collection which is not a developer site, the sideloading feature must be enabled.

Enabling app sideloading requires tenant admin permissions (in a multi-tenant environment) or farm admin permissions (in a single tenant environment). When you begin development in Visual Studio against any of the site URLs above without these permissions, the error “Sideloading of apps is not enabled on this site” will appear and the app installation will fail.

Problem: How to publish that app on non-developer site collection

Solution: There are two solutions available for apps deployment on non-developer site collection.

  1. Use “app sideloading” feature
  2. Create App Catalog for an Organization

1. Use “app sideloading” feature

What is app sideloading?

App sideloading is the ability to install a SharePoint 2013 App directly into a site to explicitly bypass the regular governance controls of SharePoint. It is a developer/test feature not intended for production use. It is not recommended to sideload apps regularly, or keep app sideloading enabled for longer than you are actively using the feature!

The developer site is designed for app developers to install and test apps before they are ready to release/publish on store.

Note: Search and Project site collection templates are not compatible with the Developer Site template.
Developers cannot test apps designed for use with those templates with the developer site alone.

The sideloading feature enables development against site collections that use a different template without affecting the UI. By enabling sideloading, an admin opens the door for anyone with app install permissions to install apps that are not sourced from the app catalog or app store.

Why this feature is not activated by default if it seems very useful?

Sideloading apps is insecure. The main reason for blocking sideloading by default on non-developer sites is the risk that faulty apps pose to their host web/host site collection. Apps have the potential to destroy data and make sites or, given enough permissions, can even make site collections unusable. Therefore, apps should only be sideloaded in dev/test environments and never in production.

It is not recommended to activate this feature. But you can find the steps as below for reference:

  1. Install the SPO management shell
  2. Download this script from code repository
  3. Execute EnableSideLoading.ps1 from PowerShell.
  4. Provide the URL for the site collection where sideloading should be enabled.
  5. Enter your user credentials. You must be a Tenant Admin to activate this feature.
  6. Once the script has run successfully, you should be able to install apps from Visual Studio!

Note: When it is no longer needed to sideload apps, make sure to disable app sideloading feature

Download this script from code repository to disable the feature.

Note: Activating app sideloading will enable you to load apps from Visual Studio, but will not get you any other features of the developer site—you will not have access to Napa or the app packages library. For these reasons, along with the other rationalizations above, it is highly recommended that you use a developer site for app loading/testing instead of sideloading or create an App Catalog for an Organization.

To view the logs for sideloading activation/deactivation, execute the PowerShell cmdlet get-spologs.

2. Create App Catalog for an Organization

An app catalog is a dedicated site collection in a SharePoint 2013 web application (or a SharePoint Online tenancy) that hosts document libraries for apps for SharePoint and apps for Office. Administrators can upload apps for Office manifest files to the app catalog for use within their organization.

To set up the app catalog for an instance of SharePoint Online, follow these steps:

To set up an app catalog on SharePoint Online

  1. On the Office 365 admin center page, choose Admin, and then choose SharePoint.
  2. In the left task pane, choose apps.
  3. On the apps page, choose App Catalog.
  4. On the App Catalog Site page, choose OK to accept the default option and create a new app catalog site.
  5. On the Create App Catalog Site Collection page, specify the title of your App Catalog site.
  6. Specify the web site address.
  7. Specify the time zone, administrator, storage quota, and server resource quota, and then choose OK.

To add apps for Office to the App Catalog Site, browse to the site you have just created. In the left navigation pane, choose Apps for Office, and then, to upload an app for Office manifest file, choose new app.

I hope this difference aware developers to publish Apps for SharePoint on production box using App Catalog only.

About the author 

Kirti Prajapati