Maciej Wozniak
Maciej Wozniak

Reputation: 1174

Should resources in ASP.NET be compiled?

I'm trying to build a multi-language web app with ASP.NET 4.0. I've created appropriate resource files with translations inside App_GlobalResources and after running from VS everything works fine, but i was suprised that no satellite assemblies (.resources.dll) were generated.

When I changed build action to "Embedded Resource" they were created but after publishing IIS completely ignores them and uses pure .resx files from App_GlobalResources.

Is that behaviour correct? Wouldn't it affect performance? Or should I compile these .resx files and somehow instruct my app to use them ?

Upvotes: 2

Views: 1552

Answers (1)

vcsjones
vcsjones

Reputation: 141588

ASP.NET does compile them "on the fly", it just puts them in a place you don't see (example: %WINDIR%\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files), so there is no huge performance impact, just on application startup for the first time or on startup if the compiled cache is no longer valid (i.e. you changed it).

The assembly is usually named something like App_GlobalResources.xxxx.dll where xxxx is some hex value.

Upvotes: 4

Related Questions