Refactor a whole solution

Topics: Developer Forum
Feb 3, 2009 at 6:06 PM
In the company I work we have a big solution with many projects inside it.
We wanted one assembly, i.e. one project, to have a resource that contains all log strings in the solution.

I extended the ResourceRefactor plugin in order to support such functionality.
If you are interested, I can give you the source. The project is for VS 2008 only.

The modified version of the plugin has two "Replace string as" options:
As a property (the same as now)
As a string ID (a new option allowing projects that do not refer the resource "Designer.*" file to use it).
Feb 4, 2009 at 6:18 AM
It sounds like you're using either a string or an int as ID for your resources. It would be better to keep the concept of Resource Designer with its strong typed, compiling time checked resources, wouldn't it ? That means you would have a unique public Resource Designer in your resources project.

I am not sure I made myself clear though... Out of curiosity, if you could provide a sample that would be much appreciated.
Feb 5, 2009 at 7:16 PM
I keep the old behavior of ResourceRefactor.

The modification with the string IDs is done because of multilanguage support I have to make.
Suppose you have a solution with 2 projects: ProjSrc and ProjFoo and a string inside a source file in ProjSrc should be refactored.
You can choose the destination resource to be either in ProjSrc or in ProjFoo:

I. If you choose to add the string to a resource in ProjSrc, you have 2 options:
  1. The current ResourceRefactor behavior (replacement with a generated property).
  2. Replacement of the string with its resource ID - very handy if you need to store logging messages that later will be translated.
II. If you choose to add the string to a resource in ProjFoo, you can replace the string only with its string ID, because ProjSrc will not have the resource (and respectively - will not have the corresponding property).

The benefit of this modification is that it allows only one project inside the whole solution to store all localizable strings.

I don't quite understand you about providing a sample. Do you mean to give you the binaries?

Feb 12, 2009 at 11:02 AM
Thanks, your explanation made it quite clear indeed. I still see a "danger" in using the bare resource ID, but I understand your point with logging messages.

Could you get in touch with Resource Refactoring Tool's developers to submit your improvement ?