Add Application Resource Files

This recipe allows to add a file which should be deployed to the Global Assembly Cache.

Recipe Description

Application resource files are mainly used for .resx files in application pages. They are deployed to folder VirtualDirectories\80\App_GlobalResources of a web application.

This functionality only works in SharePoint 2010. In earlier versions files could not be deployed to VirtualDirectories\80\App_GlobalResources with wsp solutions.

In SharePoint 2010 application resource files are deployed with wsp solutions to folder 12/CONFIG/Resources/ and copied to VirtualDirectories\80\App_GlobalResources with stsadm -o copyappbincontent.

Alternatively these files could be copied with a feature receiver:
- For Central Administration resources (and sitemaps): SPWebService.AdministrationService.ApplyApplicationContentToLocalServer();
- For Application Page resources (and sitemaps): SPFarm.Local.Services.GetValue().ApplyApplicationContentToLocalServer();

In the Visual Studio project application resource files are located here:
80/BIN/resources

Application resource files are located in manifest.xml here:
<Solution xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SolutionId="00000000-0000-0000-0000-000000000000" ResetWebServer="True" xmlns="http://schemas.microsoft.com/sharepoint/">
 <ApplicationResourceFiles>
  <ApplicationResourceFile Location="80\resources\testfile.gif/>
 </ApplicationResourceFiles>
 <!-- new in SharePoint 2010 -->
 <App_GlobalResources>
  <App_GlobalResourceFile Location="80\resources\testfile.gif/>
 </App_GlobalResources>
</Solution>

These files are deployed to C:\inetpub\wwwroot\wss\VirtualDirectories\80\App_GlobalResources in a webapplication.

Arguments

Name Description
Source Files

Authors

  • Torsten Mandelkow

Version history

  • 1.0 Initial Recipe