Multiple Resources Files in . NET

Asked

Viewed 46 times

1

It is possible to have 2 Resources files in visual studio with the same Resources name, one of which is intended for test environments and another for production environments?

1 answer

1

Not exactly with the same name, but you can have a file with the same prefix, adopting a suffix as differentiation, for example:

  • MinhaResource.Debug.resx
  • MinhaResource.Release.resx

In your application’s configuration file (App.config or Web.config, depending on the nature of the application), you can define the parameterization of which environment is being used:

<configuration>
  ...
  <appSettings>
    <add key="Ambiente" value="Release" />
  </appSettings>
  ...
</configuration>

To load the Resource using this setting, you may need to create your own ResourceProvider. As the explanation is very extensive, it is not worth including it in the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.