in SharePoint 2013

Deploying Root Items in apps for SharePoint

SharePoint development has never been easier, thanks to Visual Studio SharePoint Tools. If you remember the Visual Studio Extensions for Windows SharePoint Services (VSeWSS), you will know what I mean.

To deploy specific files (like pages, scripts etc.,) in SharePoint from your app or solution, you have to know about Modules in SharePoint which groups items into folders and specify where each item in the module gets deployed.

If you create a new SharePoint-hosted app, you will see the following modules added by default by Visual Studio:

  • Content
    • Items are deployed to: {site}/Content/
  • Images
    • Items are deployed to: {site}/Images
  • Pages
    • Items are deployed to: {site}/Pages
  • Scripts
    • Items are deployed to: {site}/Scripts

SharePoint-hosted app

so what about ‘real folders’ and files in the root of your project?

Root folders and files

You can now add root folders and items to your app for SharePoint project and they will be deployed to the root of your site automagically!

So, you can have something like this:

Root Folders

As you can see, we have added folders instead of modules – css, HTML and js

They will be deployed to – {site}/css , {site}/HTML , {site}/js – respectively, just like in Modules, but less work!

You don’t have to worry about modules anymore! Need to deploy some files to SharePoint? Sure, just add them to the root of your project and reference them in other places! Visual Studio will take care of deploying them to SharePoint!

If you don’t want any file to deployed, such as a ReadMe file, you can do so by selecting NoDeployment as the Deployment Type in the property grid:

Root file deployment type

One thing to remember is that the root item deployment are only supported in apps for SharePoint.

Write a Comment