Solution with satellite assemblies:
After some research the best solution would be Creating Satellite Assemblies.
A satellite assembly is a compiled library (DLL) that contains (“localizable”) resources such as strings, bitmaps, etc. You are likely to use them when creating a multilingual (UI) application. Satellite assemblies provide you with the capability of designing and deploying your solution to multiple cultures, rather than hard coding strings, bitmaps, etc., into your main application. Satellite assemblies are used to deploy applications in multiple cultures (not languages), with 1 satellite assembly per culture - this is the default behavior, but you can obviously have more granular control if you handle the build process manually.
When working with satellite assemblies you can even override the default culture contained in the original dll.
Solution with custom ResourceManager
Last you could roll your own Resource class implementation based on the one that is generated by the resx files and then select no code generation on the editor.
public class PersonResources
{
private static System.Resources.ResourceManager resourceMan;
private static System.Globalization.CultureInfo resourceCulture;
static PersonResources() {
// shouldbe something like "MyAssembyName"
string assemblyName = System.Configuration.ConfigurationManager.AppSettings["ResourceAssembly"];
if (!string.IsNullOrEmpty(assemblyName)) {
resourceAssembly = System.Reflection.Assembly.LoadWithPartialName(assemblyName);
resourceName = resourceAssembly.GetName().Name + ".Resources.PersonResources";
}
}
private static readonly System.Reflection.Assembly resourceAssembly;
private static readonly string resourceName;
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
public static System.Resources.ResourceManager ResourceManager {
get {
if (ReferenceEquals(resourceMan, null)) {
System.Resources.ResourceManager temp = new System.Resources.ResourceManager(resourceName, resourceAssembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
public static System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
public static string NameKey {
get {
return ResourceManager.GetString("NameKey", resourceCulture);
}
}
public static string LastNameKey {
get {
return ResourceManager.GetString("LastNameKey", resourceCulture);
}
}
}
You would have to make one class per resource type and based on your description you would then put these classes on your BaseWebApp. Check the resourceAssembly
& resourceName
members above, they are populated in the static constructor via AppSettings where you must point to the assembly that has the embedded resx files.
Original Solution
You should simply move the resources to accompany the project where the VMs are located. That would be your BaseWebApp.
An other way to do it is make a dedicated resources project and mark the classes generated by your resx's as public instead of the default which is internal. This may help you organize your resources better.
