Friday, December 7, 2012

In this article we will discuss about how to deploy jQuery files to SharePoint Asset library, so that it will be available to the particular site collection only. You can also check my last article on how to deploy jQuery files to the layouts folder using solution package in SharePoint 2010.

You can also check some various articles on SharePoint 2013. Check SharePoint interview questions and answers, SharePoint customization articles and SharePoint administration articles.

Follow below steps:
Open Visual Studio 2010, and choose File -> New Project. And then Select SharePoint -> 2010 -> Module. Give a Name to the project DeployjQuery, and click OK. Remember to select .Net framework version 3.5 as shown in the figure below:

In the next step select the local deployment URL and select "Deploy as a sandboxed solution".

Now if you will open the solution explorer it should be look like below:

In the next step Rename the Module1 module to Assets, and delete the Sample.txt file. Remember after doing this the Elements.xml file contains also changed accordingly.

Now copy the jQuery files and put it inside the Assets folder. Now the elements.xml file will change automatically but you need to add URL attribute to the Module like below:

<Module Name="Assets" Url="SiteAssets">

The full elements.xml file should be like below:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
  <Module Name="Assets" Url="SiteAssets">
  <File Path="Assetsjquery-1.6.2.min.js" Url="Assets/jquery-1.6.2.min.js" />

Now if you deploy and check the Site Assets folder the jQuery files should be there.

But before deployment it is good to give a good name to the feature.

So expand the Features folder and rename Feature1 to jQueryFeature and then double click on jQueryFeature.feature. From there change the Title and Description and also you can set the Scope of the feature.

Now you can deploy the solution. Once the deployment is over the jQuery files can be browse like below:

If you want to deploye the wsp through powershell or stsadm then follow this article.


Post a Comment