In this blog we will discuss about how we can deploy jQuery to SharePoint using solution package. The advantage of deploying to the filesystem is that the jQuery library will be available throughout your whole SharePoint environment.
There are different options available for deploying jQuery to SharePoint. One approach is using solution package (.wsp) file.
Once you deploy jQuery to SharePoint, then you can write like below to call jQuery in web parts.
Follow below steps to make the WSP that will deploy the jQuery files to the server:
Open Visual studio 2010 then Go to File -> New Project.
Then Select SharePoint -> 2010 and then Select Empty SharePoint project and give a name, and also make sure .Net framework 3.5 has been selected as shown in the figure below:
In the next step, give the local deployment site URL and choose Deploy as Farm Solution since we are going to deploy files to the Layouts folder. Ref figure below:
Now Right click on project and select Add ->SharePoint "Layouts" Mapped Folder as shown in the figure below.
After step-4, SharePoint will add Layouts folder as well as another folder with same name as the project. The reason it adds the extra folder is to try to keep the Layouts folder tidy as well as making sure you are not overwriting existing files when you deploy your solution.
Now copy your jQuery files to that folder as shown in the figure below:
This finishes our task. Now right click on the solution explorer click on deploy. Once the deployment is over.
Navigate to the layouts folder, the jQuery files should present is the below location:
C:\Program Files\Common Files\Microsoft Shared\Web Server
If you want to deploye the wsp through powershell or stsadm then follow this article