The project was organized as follows:
The EpicApplicationMaster solution contains two projects:
- EpicClassLibrary: a class library (a.k.a. an assembly) to potentially be shared by multiple applications.
- This class library contains a resource file named, ResourcesThatWouldBeSwellToShare.resx
- EpicWPFApplication: a stock WPF application that references the EpicClassLibrary project.
The previous screenshot demonstrates two resources (ScaryPurpleDinosaur and MotherlyAdvice) that could be shared with other applications.
Within Solution Explorer it is possible to double click on the C# file, ResourcesThatWouldBeSwellToShare.designer.cs, associated with resource file, ResourcesThatWouldBeSwellToShare.resx. This reveals the C# code generated based on the resources defined:
The ResourcesThatWouldBeSwellToShare.designer.cs is generated by a custom build tool that takes as input the resource file, ResourcesThatWouldBeSwellToShare.resx, and generates the corresponding C# code. To see this tool right click on ResourcesThatWouldBeSwellToShare.resx from within Solution Explorer and select the Properties item from the context menu:
Selecting Properties from the ResourcesThatWouldBeSwellToShare.resx context menu displays the following:
The value for the "Custom Tool" property is ResXFileCodeGenerator which is the tool responsible for generating the C# class with the internal access modifier. There is no way to pass a command-line value to ResXFileCodeGenerator in order to tell it to generate public as the class' access modifier.
To create a resource files with the class generated contains public as the access modifier replace the ResXFileCodeGenerator custom tool with PublicResXFileCodeGenerator:
The name of PublicResXFileCodeGenerator indicates that it creates public rather than internal classes from resx files. Building the code following the aforementioned change generates a public class:
No comments :
Post a Comment