string resourceBackUpName = this.GetResourceBackUpName(resxFilePath);//back up the res file
File.Copy(resxFilePath, resourceBackUpName);ResXResourceReader reader = new ResXResourceReader(resourceBackUpName);
reader.UseResXDataNodes = true; // set it for get commentsResXResourceWriter writer = new ResXResourceWriter(resxFilePath);
foreach (DictionaryEntry entry in reader)
{
ResXDataNode tmpNode = (ResXDataNode)entry.Value;AssemblyName[] assemblies = Assembly.GetExecutingAssembly().GetReferencedAssemblies();
string theValue = tmpNode.GetValue(assemblies).ToString();ResXDataNode trimNode = new ResXDataNode(entry.Key.ToString(), theValue);
trimNode.Comment = tmpNode.Comment;writer.AddResource(trimNode);
}
reader.Close();
writer.Close();