.net - Managing resources via compilation flags -
Any ideas how can I do this?
Now days it is the resources Designer.vb
We have the following lines there:
More ReadOnly property ResourceManager () Global.System.Resources.ResourceManager go Object.ReferenceEquals (resourceMan, for nothing) then as #if WizardVersion then dim temporary Global.System.Resources.ResourceManager = new Global.System.Resources.ResourceManager ( "Wizard. Resources ", GetType (resource) .Assembly) #ElseIf CalculatorVersion then dim temporarily Global.System.Resources.ResourceManager = new Global.System.Resources.ResourceManager (" Calculator.Resources ", GetType (resource) .Assembly) #ElseIf ViewerVersion Then slow Temporary Global.System.Resources.ResourceManager = Ger ( "viewer as new GlobalkSystemkResourceskResourceMana. Resources", GetType (resources). Assembly) # If Snsadnman = temporary cessation that returns Snsadnman End End End End Property < / Code> That file is reproduced every time through the compiler, so every time I need to add those rows manually.
Can you recommend another way to do this?
Thank you.
You can use reflection to overwrite the resource manager created by the resource group: < / p>
sub initResources () as #If Wizard version dim temporary Global.System.Resources.ResourceManager = new Global.System.Resources.ResourceManager ( "Wizard.Resources", GetType (resources). Assembly) #ElseIf CalculatorVersion then retard temporarily Global.System.Resources.ResourceManager = New global form. Resources. Resource Manager ("Calculator .Resource", GetType (Resource). Assembly) # ElseIf V iewerVersion then retard temporarily as Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager ("Viewer.Resources", GetType (resource ) .Assembly) #END Slow resManField as System.Reflection.FieldInfo = GetType (if my .Resources.Resources) .GetField ("resourceMan", Reflection.BindingFlags.Static or Reflection.BindingFlags.NonPublic) resManField.SetValue (nothing) Is temporary) End Sub
This is why it is not very beautiful, but it should work ...
Comments
Post a Comment