It’s the fun time of the product cycle where we are – with the exception of a couple of DCRs* – feature complete and preparing to hand over our strings to the Loc team. To make sure that the strings don’t contain literal or grammatical errors the PMs review them together with our technical writers (the guys who write the msdn content). Once that’s done the strings are handed over to the Loc team, get translated and checked back in into our branch.
To find all strings (at least all of which are embedded in resources) I wrote a small WPF program which reflects over our assemblies, extracts the embedded strings and shows them in a grid (from where I can easily copy & paste everything into Excel. If I’d need this functionality more often I’d probably write a small console application instead which I then could reuse in a PowerShell script).
Here is what I did (Stop bothering me, give me a direct download!):
Private Sub btnOpenFolder_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnOpenFolder.Click
‘ Hook up the AssemblyResolve Event – which occurs when the
‘ Extract all the embedded resources from a given path
‘ and bind the extracted strings to a DataGrid
If path.Length = 0 Then
Dim query = From file In My.Computer.FileSystem.GetFiles(path, FileIO.SearchOption.SearchAllSubDirectories)
Dim ci As CultureInfo = Thread.CurrentThread.CurrentCulture
For Each file In fileNames
‘ Load the assembly
‘ Retrieve all the resources ending with “.resources”
For Each resourceName In _resourceNames
‘ remove the “.resources” from the end of the string
‘ create the respective ResourceManager
‘ and get the the ResourceSet
If resourceSet IsNot Nothing Then
Dim id As IDictionaryEnumerator = resourceSet.GetEnumerator()
If id.Value.GetType.ToString = “System.String” Then
Catch ex As Exception
Private Function AssemblyResolve(ByVal o As Object, ByVal e As ResolveEventArgs) As Assembly
Dim path1 = “The path where referenced assemblies are located.”
Public Class AssemblyInfo
To make things as easy as possible I uploaded the solution to MSDN Code Gallery.
* Design Change Request: Once a product is code complete the team focuses solely on bug-fixing and stabilizing the product and no new features are getting added. The only exception is when we learn (e.g. through a focus group working with the early product) that we’ve missed an important scenario/security issue/etc.