Deploy Resource Files in SharePoint…

While doing SharePoint projects definitely you will have to use resource files to well mange and localize your resources. Not like an application SharePoint requires you to deploy resource files to different locations.

To be clear, different operations will look the resource files in two different locations(Web parts refer one location and the resource entries in a feature manifest file looks in another etc…). The two resource locations SharePoint will look into are,

1) C:Program FilesCommon FilesMicrosoft SharedWeb Server Extensions14Resources

2) The web application Virtual Directory (typically C:inetpubwwwrootwssVirtualDirectories {the web application port number}App_GlobalResources

So when we deploy a solution what typically done is coping the resource files to these locations manually.
How to overcome these manual steps?

Option 01

But with the VS 2010 SharePoint project templates, we have two options that we can use. One is mapped folders.


By adding a mapped folder for 14Resources folder and placing your resource file inside that will automatically deploy the resource file in to the above mentioned first (1) location. But you have to copy the file manually to the (2) location.


Option 02

Or else VS2010 allows you to include element files to the project.


What you have to do is add a element file to to the project and add your resource file underneath it. Then select the resource file and set the properties as bellow.


OK and the second option will allow you to deploy the resource file to the application Virtual directory (2), but not to the SharePoint resource folder (1).


Option 03 – The Solution

So how to copy the file to the both locations without much effort???

If you see carefully into your VS SharePoint project, for each element, module, feature, web part etc.. has a SharePointProjectItem.spdata file an associated with it. This file is hidden when you view it from VS. By selecting the Show All Files option in solution explorer you can view these files as well.

1) Follow the above Option 02 steps (the steps that will create a element file and place the file in application virtual directly only)

2) Navigate and open the SharePointProjectItem.spdata file associated with your newly created element file

3) You will be viewing something like this


4) Edit the file manually and add the bellow entry to it

<ProjectItemFile Source=”MyResources.resx” Target=”Resources” Type=”RootFile” />

5) So now it will look like,



Compile, Package the solution and try deploy. Verify the two resource locations that you expect the resource files should be. Smile

Happy Resource Deployment!!!


Leave a Reply

Your email address will not be published. Required fields are marked *