Find unused resource strings
22 Jul 2010This handy tip lets the compiler warning you of any unused resource string references. Credit this blog.
Resources.Designer.cs file:
(1) Turn on Code Analysis warning CA1811
(2) In your Resources.Designer.CS file comment out the following lines:
[global:: System.CodeDom.Compiler.GeneratedCodeAttribute( …
[global:: System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
(3) Change the class to a static class by putting the word “static” in front of “class”:
internal static class Resources {
(4) Comment out the default constructor.
(5) Compile your program. Now you should be warned about any unused resources.
(6) Remove your unused resources. (Changing any resources will regenerate the Resources.Designer.cs file.)