using .NET resources without building
I h开发者_开发技巧ave application with .resx file. Resx file is simple XML, but after buliding resources save to assembly. So to changing resources i need rebuild my resource assemblies. Is there any way to use resources direct from resx file ?
If you are using the ResourceManager
class to access your resources, you can use the resgen
to compile your .resx
file to a .resources
file. You can then create a new instance of the ResourceManager
class using ResourceManager.CreateFileBasedResourceManager
instead of new ResourceManager(...)
. This allows you to specify a resource file name and a directory to search within.
For an example, take a look at approach B in this tutorial.
As mdm mentioned but not explicit wrote No you can't do that without compilation or without a ResourceManager.CreateFileBasedResourceManager
.
The Resource has a XML structure in the .resx part but this parts just shows the compiler where to find the files which should be included and it only exists in your project and not after the build.
A Resource file is defined as a embedded resource, means it is nested into a assembly. Any change will result in a need for a new compilation.
精彩评论