将解决方案部署到 Web 应用程序时,自动将资源文件部署到管理中心的 App_GlobalResources 文件夹
我正在开发一个 SharePoint 2010 解决方案,其中包含一些 Web 部件和其他组件。此外,该解决方案需要中央管理中的应用程序页面进行配置。
因此,我的解决方案包含一个额外的功能,该功能将自定义操作放置在管理中心菜单中,该菜单链接到提供配置的应用程序页面。该功能的范围为 WebApplication
,并使用设置为 True
的属性 AutoActivateInCentralAdmin
,以便在部署解决方案时在管理中心自动激活该功能到网络应用程序。我的解决方案的这一部分按预期工作。
但我遇到了一些关于管理中心中的应用程序页面使用的资源文件的问题,因为它们仅部署到解决方案部署到的 Web 应用程序的 App_GlobalResources
文件夹,而不是部署到中央管理的App_GlobalResources
。
因此,我想知道为什么在没有将资源文件自动部署到管理中心的 App_GlobalResources
文件夹时使用 AutoActivateInCentralAdmin
。
每当将解决方案部署到场中的任何 Web 应用程序时,将资源文件部署到管理中心 App_GlobalResources
文件夹的最佳方法是什么?有没有一种自动的方法?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们在这里讨论应用程序资源(而不是配置资源),它们应该部署到 {SharePointRoot}\CONFIG\Resources 文件夹。确保在部署 WSP 时将应用程序页面使用的资源文件部署到该文件夹。
创建新的 Web 应用程序时,资源最初会复制到 App_GlobalResources 文件夹中,在这里就可以了。
但是,当 Web 应用程序已经创建时(这是您的情况),您需要将资源复制到现有的 Web 应用程序。 手动执行此操作
您可以使用此命令stsadm –o copyappbincontent
,或者您可以通过在功能接收器中的 FeatureActivated 事件中包含以下内容来自动执行此操作(这就是您想要的)。对于管理中心资源和站点地图,请调用
SPWebService.AdministrationService.ApplyApplicationContentToLocalServer();
对于常规应用程序页面资源和站点地图,
SPFarm.Local.Services.GetValue().ApplyApplicationContentToLocalServer();
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.