How to deploy a Resource File in SharePoint 2010


Hello again 🙂

Resource files are typically any non-executable data file used by your application, such as image, audio, and video files. A resource file can also have specific meanings in certain contexts. For example, in the context of application localization, resource files refer to .resx files, which you can deploy in localized satellite assemblies.

Deployment of resource files with SharePoint has always been a little tricky. With MOSS we used features to provision resource files. With SharePoint 2010 it was a little easier but not enough.

Developers usually keep two copies of the same resource file in the project !

But today i am going to give u an easy way to deploy only one file, and guess what it works !! and it will save u the trouble of having to update 2 files !

so here are the steps

1. create an empty SP project:

2. create a 14\Resources mapped Folder

  • right clic on the projet
  • add a mapped folder

3

  • choose ressources folder

4

3. add your ressource file:

  • right clic on the projet
  • add new item ( or existing item if you already have ur  ressource file)

01

  • choose ressource file and name it SP.Layouts.resx

4. Add a Empty Element to your project and name it App_GlobalResources:

6

5. press “Show All Files” button from the Solution Explorer

5

6. Edit the SharePointProjectItem.spdata file inside the App_GlobalResources folder

add this code

<Files>

<ProjectItemFileSource=Elements.xml  Target=App_GlobalResources\  Type=ElementManifest />

<ProjectItemFileSource=..\Resources\CoE.SP.CS.Layouts.resx          Type=AppGlobalResource />

</Files>

or  your own path and file name.

7

7. Double click the Package folder and add the App_GlobalResource item to the Package:

8. Build and deploy, all resource files will be deployed to 14Hive and WebApplication. 14Hive.

that’s it 😉 it’s done !!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s