Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check ASPX files to make sure that Resource Key referenced exsists in RESX

I have a rather large website that had its strings externalized. I wanted to know if there was a way to check to make sure that a resource object in the ASPX exists in the resource file that is being referenced? There are a few pages that get parser errors, but I want to be able to batch check all the files.

If there is a tool or some way to check all the files and you know how I would greatly appreciate if you would be able to assist me in this.

like image 512
Russell Avatar asked May 03 '11 17:05

Russell


1 Answers

I was curious if this was possible as well, and could not find any useful information about this either. I made a proof of concept application which basically does 3 things

  1. Go through the files in the subdirectory you select, and find the ascx and aspx files in it.

  2. Search the files after the various possibilities for a resource string in them, parsing meta:resourcekey= and <%$ Resources: and flag them for being explicit or implicit depending on the key having a class or not. (Resources: tags only) and storing the local or global resx name.

  3. Search through the specified local and global resourcepath depending on which type of resource it is, and search the found resx files with a ResXResourceReader, and add any missing keys from the parsed aspx/ascx files, to be viewed in a gridview.

It does not yet handle different languages, but that should be fairly easy to add. I'm sure i'm missing a number of other things, since we normally use xml files or database for our projects resources, but it is usable and if it doesn't suit your specific needs, simply modify the source which you can find here

like image 64
Crypth Avatar answered Nov 15 '22 03:11

Crypth