0

I have a project where for localization I use classic xml files instead of resx files and I have key value pairs. But now the files and the project have become so large that when I delete a key value pair from the file, its hard to notice if that key was used somewhere, i.e. the solution builds fine. So now I'm planning to use some kind of usages tracker for every key value pair, so if it gets removed by a mistake, it would show up as build error for example.

I am trying to use Microsoft.CodeAnalysis for this, so when a key gets deleted/modified it would do a find-all and if it finds an occurence of the key it would warn the user. But I don't know if searching all files in the solution by code is a good idea. I was thinking if I could use Visual Studio's find all functionality but through code, is that a thing at all?

  • Hello, do you mean to delete useless elements in xml? You can search using an XML parser: You can use an XML parser to analyze an XML file and find elements that are not used in your application code. You can use the XmlDocument class or the XDocument class in the System.Xml namespace to parse an XML file and find elements that are not used in your application code. If that's what you need, please let me know and I'll post some code. – wenbingeng-MSFT Mar 13 '23 at 07:23

0 Answers0