1

I am trying to access my language localization resource file which is in the same solution, but in a different project then the one I am currently working on. I don't want to use multiple resource files so how do I access a resource file in a different project when working within xml?

Here is what I have so far, but this accesses the resource file in the same project:

  <CustomAction Id="WorkflowConfig" 
            GroupId="ProjectSiteSettings"
            Location="Microsoft.SharePoint.SiteSettings" 
            RequireSiteAdministrator="TRUE"
            Sequence="130"
            Title="$Resources:WorkflowConfig"
            >
3

For shared resource files in SharePoint (i.e. RESX files that must be shared amongst Features/Projects/Solutions), the best thing to do is to deploy them to the SharePoint Root's "Resources" folder (14/Resources). Then you'd reference them in one of two ways.

In the RESX reference, you can specify the file name in the RESX reference like so (leaving off the .resx file extension):

Title="$Resources:myCustomRESXFile,WorkflowConfig"

Assuming using Visual Studio 2010 tools, modify "Default Resource File" property of the feature (in the properties editor while the Feature is open).

This describes the process for a List, Content Types, Fields, but just as applicable to a element:

http://msdn.microsoft.com/en-us/library/ff955226.aspx

Note, if this is a Sandboxed Solution, you may have problems because the RESX support for Sandboxed features is limited and inconsistent. See my question on this topic: Sandbox Content Type and Resource (RESX) File

1

You can use following:

$Resources:FileName,Key;

File name should be without extension. But do not foget to setup feature dependency if your xml is located in another feature as resources files.

  • I tried using that "$Resources:LanguageLocalization,WorkflowConfig" but with no luck. Do I need to add the project or namespace the FileName is in? – Meyer Denney Mar 26 '12 at 19:38
  • 1
    Try to reset iis. There is an issue when resources files are not accessable after deployment. – Alexander Mar 26 '12 at 19:40
0

If you want to be able to reuse the same resource file in multiple solutions then you should place it in the {SharePointRoot}\Resources folder.
Make sure you give the .resx file a name which will be unique as you can't put it in a seperate folder. If you give the file the name Meyer.Denney.Workflow.resx then you can access the WorkflowConfig using

$Resources:Meyer.Denney.Workflow,WorkflowConfig;
  • Yeah, don't name the RESX file core.resx...you'd overwrite an pretty important RESX file from SharePoint. :) – Brian Mar 26 '12 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.