Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove App_LocalResources from Build Process

We have a Large-scale Application and it have dozens of resx file to localize application

these files build each time and take much time to build and the build process goes longer

how to remove these kind of files from build process

like image 842
Nasser Hadjloo Avatar asked Jan 21 '10 13:01

Nasser Hadjloo


2 Answers

Maybe I'm missing somethings. If you are after to exempt ASP.NET from generating code for .resx files, you have to remove its build provider as follows.

<compilation>
  <buildProviders>
    <remove extension=".resx"/>
  </buildProviders>
</compilation>
like image 124
Mehdi Golchin Avatar answered Oct 17 '22 21:10

Mehdi Golchin


I believe the default ASP.NET Resource Provider picks up local page resources using a one-to-one relationship between the pages themselves and associated *.resx files in your App_LocalResources folder. I'm not sure there is a way to change this default behaviour.

It is possible however; to implement your own Resource Provider and Resource Provider Factory. This is done by implementing the IResourceProvider interface to define your own methods for resource retrival and also creating an associated ResourceProviderFactory to instantiate instances of your custom provider.

Once you've done this you can reference the custom provider factory by adding the following to your Web.config file:

<system.web>
  <globalization resourceProviderFactoryType="Company.Product.CustomResourceProviderFactory" />
</system.web>

Using this you could - for example - switch to storing your localisations in a database (as described in the guide here) instead of compiling them with your application each time, thus hopefully improving the build speed.

like image 2
Dougc Avatar answered Oct 17 '22 21:10

Dougc