All,
I'm having problems with my resource manager in ASP.NET 2.0 after conversion
from ASP.NET 1.1.
Here is a background:
In ASP.NET 1.1
All my user controls and aspx pages inherit from base classes. A base class
includes this property (among others...;-)):
Private m_rscResources As System.Resources.ResourceManager
Public ReadOnly Property rscResource() As System.Resources.ResourceManager
Get
If m_rscResources Is Nothing Then
m_rscResources = New
System.Resources.ResourceManager("MyPortalNamespac e.Strings",
System.Reflection.Assembly.GetExecutingAssembly)
Return m_rscResources
Else
Return m_rscResources
End If
End Get
End Property
In my application root folder I have two files. One strings.resx and one
strings.sv.resx. When I call the rscResource.GetString method I simply use
the tag name to get the translation.
Label1.Text = rscResource.GetString("First name")
In 1.1 this works absolutely fine. However, In 2.0 (after conversion), it's
not working. The error message I get from .NET is:
System.Resources.MissingManifestResourceException was unhandled by user code
Message="Could not find any resources appropriate for the specified
culture or the neutral culture. Make sure
"MyPortalNamespace.Strings.resources" was correctly embedded or linked into
assembly "App_Code.lkep0udn" at compile time, or that all the satellite
assemblies required are loadable and fully signed."
I've tried to dynamically get the current executing assembly name like this:
m_rscResources = New
System.Resources.ResourceManager(System.Reflection .Assembly.GetExecutingAssembly.GetName.Name
& ".Strings", System.Reflection.Assembly.GetExecutingAssembly)
Same error message (but 'MyPortalNamespace' is replaced).
I've tried a number of things to work around this, but I still get this
error message. I've tried placing the resource files into different
directories including App_Code, App_GlobalResources, application root etc.
None is making it better.
So, here I stand...
I want to clarify that I know how you can use resources in 2.0, but that's
from scratch. I have hundreds and hundreds of places where I use
rscResource.GetString("MyKey") and I really don't feel I want to change all
that now.
Any help and/or suggestions are more than welcome. I'll be happy to assist
with more project details in case you need it.
Thanks in advance,
Fredrik Rodin,
Stockholm, Sweden