views:

44

answers:

2

I'm developing a SharePoint 2010 solution which consists of some web parts and other components. Furthermore the solution needs a application pages in the Central Administration for configuration.

So my solution contains an extra feature which places a custom actions in the Central Administration menu that links to a application page providing the configuration. The feature has the scope WebApplication and uses the Attribute AutoActivateInCentralAdmin set to True so the feature is automatically activated in the Central Administration when the solution is deployed to a web application. This part of my solution works as expected.

But I've got some issues regarding the resource files which are used by the application pages in the Central Administration as they only get deployed to the App_GlobalResources folder of web application the solution was deployed to but not to the App_GlobalResources of the Central Administration.

So I'm wondering why to use the AutoActivateInCentralAdmin when there is no automatic deployment of the resource files to the App_GlobalResources folder of Central Administration.

What is the best way to deploy the resource files to the Central Administrations App_GlobalResources folder whenever the solution is deployed to any web application in the farm? Is there an automatic way to this?

+2  A: 

We are talking about Application resources here (as opposed to provisioning resources) and they should be deployed to {SharePointRoot}\CONFIG\Resources folder. Make sure the resources files used by your application pages are deployed to that folder when your WSP is deployed.

When a new web application is created, the resources are initially copied to the App_GlobalResources folder, you are fine here.

But when web application is already created (which is your case), you need the resources to be copied to existing web applications. You can do this manually with this command

stsadm –o copyappbincontent

Or you can automate (which is what you want) this by including the following in your FeatureActivated event in your feature receiver. For Central Administration resources and site maps, call

SPWebService.AdministrationService.ApplyApplicationContentToLocalServer();

For regular application page resources and site maps,

SPFarm.Local.Services.GetValue().ApplyApplicationContentToLocalServer();

Ashish Patel
Correct me if I'm wrong but both stsadm -o copyappbincontent and ApplyApplicationContentToLocalServer() only copy the resource files on the local server. So on a farm you would have to execute the command (the one or theon each front end web server. This solution is no option for me.
Flo
Ignore my first comment, I pressed "add comment" before I finished it. ==> Correct me if I'm wrong but both stsadm -o copyappbincontent and ApplyApplicationContentToLocalServer() only copy the resource files on the local server. So on a farm you will run into two problems. With the stsadm you would have to execute the command on each front end server. With the ApplyApplicationContentToLocalServer() method in the feature receiver the resource would only be copied on the server on which the feature was activated but not on all front end server. So both options are no solution for me.
Flo
I see your concerns. There are people who have ran into similar issue and I know in MOSS world they ended up with custom timer job which kicks off during feature activation. You may have come across this as part of your investigation but still.. : http://sharepointinterface.com/2009/06/06/the-applyapplicationcontenttolocalserver-method-and-why-it-comes-up-short/
Ashish Patel
Ok, then I'll try this option. Thx.
Flo
+1  A: 

You need to create a Custom Timer Job for this. If you search on internet, some people have already developed such job.