SharePoint 2010, VS 2010 and Deploying Resources to the App_Global Resources folder

When you are localizing a SharePoint site, you may need to get your .resx files to the App_Global resources folder in your virtual directory for the web application. This gave us a bit of trouble, so I thought it would be worth writing down. And funnily enough, the answer is very simple and provided by Visual Studio 2010 (VS2010's integration with SharePoint 2010 is pretty awesome).

We'll start by adding a New SharePoint 2010 item: an Empty element

And name it "Resources"…



After adding the Empty Element Item to your project, you can add your .resx files to its folder. Once your resx file is there, you'll want to edit the properties to configure its deployment to the App_GlobalResources folder.

First, set the DeploymentType property to AppGlobalResource.



Once the Deployment Type is set, VS will automatically set the Deployment Location property to "{WebApplicationRoot}\App_GlobalResources\{PROJECT_NAME}\Resources\", which isn't really useful to us.



So, we expand the Deployment Location node, and edit the Path property. Basically just clear out the Path property, so that your .resx file gets deployed to the App_GlobalResources root folder. And that's it! When your package gets deployed, your .resx files will go where you need them. Hope that helps someone :)

Comments

Post a Comment

Popular posts from this blog

Windows Phone 7 - Impressions and Transparent Lockscreen

Bun Rieu from Lemongrass