I've heard about the Codesmith and Resharper and I think they're good but not free, can you recommend the free alternatives?
Also Resharper isn't really a code generator anyway - it's more of a refactoring and productivity tool.
I'd expect CodeSmith version 2.6 to always be free. I've found the later versions do not provide much added value. One limitation of 2.6 out-of-the-box is that it uses the framework 1.1 - however the app.config can be easily modified so it runs under a later version (2.0 at least).
Since you mention Resharper, I assume you're using Visual Studio - if so, there's a "Text-Transformation Templating Toolkit" (a.k.a "T4") built into VS 2008 and higher.
It's somewhat similar to CodeSmith and others - much less powerful for more, though - but it's right in the box, free, and works wonders for easy tasks!
See more info on it here and here.
Cheers, Marc