views:

217

answers:

2

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

+1  A: 

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.

Dougc
Dear Dougc, your solution is to change Resource Provider, this isour current alternative but we strongly looking for a solution to build these withcurrent settings. something like using Nant or editing MSBuild behav ...
Nasser Hadjloo
+3  A: 

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>
Mehdi Golchin
Typical of me to look for the long winded solution!
Dougc
Dear Mahdi, Where Should I add this Configuration ? and is it possible to force build or not to build , one or some Resx file ?
Nasser Hadjloo
The `buildProviders` is available configuration property of `compilation` section in the `web.config`. IMO, it's impossible to ignore special files. ASP.NET build providers generate code for a specified extension.
Mehdi Golchin