Inconsistent naming of embedded resources

JarrodKochJarrodKoch USMember

In the project I am working on, we are sharing strings between iOS and Android apps. We have an xml files in a core assembly which are marked with a build target of EmbeddedResource (one file per culture).

At runtime, the proper culture-specific file is chosen by interrogating the assembly's embedded resources and selecting the one which is in a subfolder matching the current culture. The resource names are retrieved by calling Assembly.GetExecutingAssembly().GetManifestResourceNames(). Unfortunately, when building in Visual Studio (2010) on a PC, the dashes in the names of the folders are replaced with an underscore, but in Xamarin Studio on OSX this does not occur.

While there likely is some other way I could be naming the folders which contain the culture-specific resource string files, shouldn't the creation of embedded resource names behave the same across platforms?

Posts

  • JarrodKochJarrodKoch USMember

    To be clear, the behavior I am seeing is the following:

    Building in Visual Studio 2010 on a PC, resource name is:

    MyNamespace.Res.en_US.strings.xml

    Building in Xamarin Studio on OSX, resource name is:

    MyNamespace.Res.en-US.strings.xml

  • JarrodKochJarrodKoch USMember

    In case anyone else runs into this problem, you can provide a logical name for your embedded resources rather than allowing the environment to automatically name them.

    See this MSDN blog post for information about providing a logical name.

Sign In or Register to comment.