开发者

Automatically deploy resource files to Central Administration's App_GlobalResources folder when deploying a solution to a web application

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 开发者_JAVA百科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?


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();


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜