CodeSmith CodeSmith allows you to create templates that will generate code for any ASCII based language. The code generated can be customized by the use of properties. A property can be any .NET object that has a designer (most built in .NET types have designers already) and can be as simple as a boolean property that allows you to conditionally add or remove code from the result, to an object such as the included TableSchema object which provides everything you could possibly want to know about a table in a database. Having access to this information allows you to generate things such as stored procedures, business objects, presentation layer code, or anything else you can think of based on a table schema. CodeSmith's syntax is almost identical to ASP.NET. So if you are familiar with ASP.NET then you should be able to quickly learn the template syntax. You can use the C#, VB.NET or JScript.NET languages in your templates. The CodeSmith Explorer window allows you to view all templates in a given folder and allows you to drag and drop to any target that supports dropping text. You can also double-click a template to execute it individually after the first time you run CodeSmith. I hope to receive feedback, bug reports and hopefully some useful templates to include in future versions. I am also interested if someone would be willing to help with documentation. CodeSmith is a FREEWARE product. I am still considering releasing source code, but I would rather maintain control of the product in a single location. I think this will provide the best opportunity to build a solid community of users and templates. I also plan to build a template repository site that will allow anyone to submit a template and have it added to the repository. Enjoy, Eric J. Smith http://www.ericjsmith.net/codesmith/ -------------------------------------------------- History -------------------------------------------------- Build 2.6.0 (RC1) * Added GetCodeTemplateInstance method to CodeTemplate. This can be used to compile and create an instance of another template. * Added Toggle Template Code Expansion feature. This allows easy viewing of the static content in the template. (Shortcut CTRL-SHIFT-M) * Fixed up the syntax highlighting editor dialog and made it persist the settings. * Made it so that you can manually enter a delimited list of strings for StringCollection in the property grid. * Added several options to the options dialog. * Improved outlining. * Fixed various minor bugs. Build 2.5.18 (BETA) * More performance improvements in the core CodeSmith engine. * Made it so that if you reselect the same schema object it will refresh the schema information. * Made the enter key open the selected template in CodeSmith Studio. * Fixed bug with saving a property set file while overwriting an existing property set file that is set to read only. * Made CodeSmith Studio a single instance application. * Fixed bug where trying to open a file that was already open would cause the file to re-compile itself. * Fixed bug when compiling templates that have ( ) or ' in their file names. Build 2.5.17 (BETA) * Fixed issue with CodeSmith Studio hanging sometimes when <% was typed. * Made the VS.NET custom tool MUCH better. It now reports errors in much more detail. * Added variable support to the VS.NET custom tool. * Added default property support to the VS.NET custom tool. * Made it so that goto line now expands the regions the line is on. Build 2.5.16 (BETA): * Made various performance improvements to the engine and CodeSmith Studio. * Added syntax highlighting to target languages. * Added outlining support to CodeSmith Studio. * Added line modification markers to CodeSmith Studio. * Added auto copy output to clipboard option in CodeSmith Studio. * Fixed several find and replace bugs. Build 2.5.15 (BETA): * Added ToString override to the schema collections so that the names of the selected objects show up. * Stopped indenting script blocks. * Fixed highlighting issues with escaped template tags <%% %%>. * Made register menu item hidden when already registered. * Fixed bug where pressing F4 on codebehind causes exception. * Changed RenderToFile using a merge strategy so that it creates a file if it doesn't exist. * Changed the output encoding to UTF-8. * Fixed bug in editor control where a black box was sometimes drawn. * Fixed bug in editor control where a clipboard operation would sometimes cause an exception. * Updated to the 1.5 version of Chris Nahr's collection templates. * Various other minor bug fixes. Build 2.5.14 (Final): * Turned CodeSmith Professional licensing on. Build 2.5.13 (RC4): * Fixed the check to see if a given file is already open (was case-sensative). * Fixed issue with setting properties programmatically if they were not an exact type match but were still related types. * Disabled the replace and replace all buttons on the find dialog if a document is read only. * Fixed the StoredProcedures.cst template to handle user defined types. * Made it so that the explorer tree doesn't do a complete refresh on every file save. * Fixed painting issues in the Highlighting Style Editor dialog. * Fixed issue with the find function not always moving the find result into view. * Fixed issue with CTRL-TAB and new documents. * Fixed template parser to allow escaped "'s in the directive attributes. Build 2.5.12 (RC3): * Fixed bug in SqlSchemaProvider where tables with .'s in their name would cause an error. * Changed SchemaExplorer to lazy load extended properties. This made a huge difference in databases with a lot of schema objects. * Fixed bug with RenderToFile where the file handle was not being released if an error occured during template execution. * Added the awesome DBDocumenter templates to the samples. * Added the C# CSLA.NET templates by Ricky Supit. * Added the StoredProcedureDescriptions.cst template by Oskar Austegard. * Fixed bug with save all button where not all documents would be saved. * Added context menu to the output and compiled source editors. * Fixed bug in the logo header of CodeSmithConsole. * Fixed bug with determining if a file has been modified in CodeSmith Studio. * Fixed various issues with the goto line feature in CodeSmith Studio. * Fixed formatting issue with template comment tags. * Fixed bugs with commands enabling and disabling in CodeSmith Studio. * Changed the F6 mapping in Studio to toggle between views of the current document. * Changed build shortcut to CTRL-SHIFT-B. * Fixed bug with external change modification notice. Whenever you closed a document and re-opened it you would then get errant external change modification notices. * Fixed bug with CTRL-F sometimes causing a crash. * Fixed various painting issues in the editor control. * Added option to determine code behind open behaviour in CodeSmith Studio. * Fixed issue with various menu item actions not updating the document title. * Changed CTRL-TAB and CTRL-SHIFT-TAB to behave the same as VS.NET. * Added ability to select template editor application from CodeSmith Explorer. * Made it so the template will recompile if the code behind file has been modified. Build 2.5.11 (RC2): * Fixed parser bug where whitespace would not be correctly handled in some scenerios. * Fixed bug with custom assembly resolution. * Fixed bug when closing multiple instances of Studio at the same time. * Fixed bugs in a few sample templates. * Fixed bug when using a \ in the find dialog. Build 2.5.10 (RC1): * Added some new help content. Thanks to James Avery. * Updated to the latest collection and CSLA.NET templates. * Added State (values: Default, Rendering, Validating, RestoringProperties, SavingProperties) property to CodeTemplate. This can be used to tell what the template is currently doing. * Fixed bug when saving a newly created template. * Made the close start page on open setting work for all ways of opening files. * Fixed bug in collections where indexers threw an exception for items that did not exist. These indexers now return null if the item is not found. * Added override for ToString() in CodeSmith.CustomProperties.StringCollection so that the items show up in the propertygrid instead of the type name. * Fixed bug in RestorePropertiesFromHashtable where you get a NullReferenceException when trying to populate a property that has been removed since the last compile. * Fixed bug in the about box where some names were being cut off. * Fixed bug with Load Property Set XML in the stand-alone property grid. * Fixed bug in CodeSmith Explorer with template folders that no longer exist. * Fixed bug in CodeSmith Studio with opening files that no longer exist. Build 2.5.9 (Beta): * Added context menus to the document tabs. * Added CopyPropertiesTo method to CodeTemplate. This can be used to copy all matching properties from one template instance to another. * Dramatically improved compiler performance on large templates. * Lots of improvements to the CodeSmith Explorer control. * Rebuilt all of the Schema Explorer collections using the awesome collection templates by Chris Nahr. These collections are now editable, although the instances returned by Schema Explorer are marked as read-only. * Fixed bug where enum values were not being maintained during template compilation. * Fixed bug where new files were not added to the MRU list. * All configuration files have now been moved to the current user's ApplicationData folder. It should now be possible to run CodeSmith as a non-Administrator user. * Added folder monitoring to Explorer so that new files are automatically picked up. * Added monitoring to all documents in CodeSmith Studio so that external changes are picked up. Build 2.2.8 (Beta): * Added tool tip to document tabs in CodeSmith Studio. * Added keyboard shortcuts to almost everything in CodeSmith Studio. * Added ability to open any file type in CodeSmith Studio. * Added error underlines to the compiled template source when there are compilation errors. These also have tooltips to display the error message. * Added Select All, Copy Output, Save Output, and Compile To Assembly menu items. * Added Insert Content menu items and shortcuts. * Added dialog to ask if you want to open the code behind for a template if it uses one. (this really should be another tab in the template editor.) * Added F3 support and made various fixes to the find and replace operations. * Added menu item to save output to file. * Added Windows menu to CodeSmith Studio. * Added recent files menu to CodeSmith Studio. * Added context sensative enabling/disabling of commands in CodeSmith Studio. * Added options dialog with various settings. * Fixed parser bug where comments (<%-- --%>) would collapse a line with other content on it. * Added ability to change language background color in the highlighting style editor dialog. * Added start page / embedded web browser to CodeSmith Studio. Build 2.2.7 (Beta): * The Schema Explorer tool window in CodeSmith Studio works now (still need to have it let you manage your extended properties). * The properties grid is now used to show properties on just about everything. * Fixed bug when dropping a template onto the VS.NET Solution Explorer window. * Updated to the latest version of the CSLA.NET templates. * Created a new sample template CommandWrapperClass.cst. This template creates a C# wrapper class for a stored procedure. * There is now a Description property on all schema objects. This is simply a shortcut to the CS_Description extended property. * Made the find dialog set the currently selected text as the find value instead of it being hard-coded to "int". * Made the find dialog restore focus to the editor window when the dialog is closed. * Fixed bug in Studio where the same instance of a template was being used for multiple generations. * Added CS_IsComputed and CS_IsDeterministic extended properties to ColumnSchema and ViewColumnSchema. * Added CS_Default extended property to ParameterSchema. * Added CTRL-TAB and CTRL-SHIFT-TAB support to CodeSmith Studio. * Fixed printing issue in CodeSmith Studio where lines were not being wrapped. * Fixed bug in parser that caused <% = expression %> (space between <% and =) to be incorrectly parsed. * Fixed bug in parser that caused multi-line template comments to be incorrectly parsed. * Updated to version 1.3.1 of Chris Nahr's collection templates. * Created CodeSmith101 sample templates. Build 2.2.6 (Beta): * Implemented cursor changes in CodeSmith Studio when the application is working. * Fixed bug in extended properties where extended property value was NULL. * Fixed several clipboard issues in CodeSmith Studio. * Added error trapping around template execution so that it's obvious the exception was from bad code in the template and not CodeSmith. * Updated to version 1.3.0 of Chris Nahr's collection templates. * Fixed bug in CodeSmith Studio where template properties would be lost after a failed compilation. * Added code to allow enum property types defined in multiple templates to be converted back and forth. Build 2.2.5 (Beta): * Added icons to the Visual Studio .NET tool window and command. * Added a blank data source to all designers. * Added context menu items to the property grid to copy, save and load the property set XML. * Fixed bug with right-clicking in the property grid on a category cell. * Made a lot of internal changes to cleanup the way CodeSmith was searching for assemblies. * Replaced VSUserControlHost with CodeSmithUserControlHost. I believe this change will fix the infamous "Invalid VSUserControlHost" error message in Visual Studio. * Added a ScriptTableData.cst sample template. * Made CodeSmith Studio persist highlighting style changes. * Added Schema Explorer tool window to CodeSmith Studio. * Fixed highlighting bug where single line comments would over-ride the end of a template block (%>). * Added highlighting support for template comments (<%-- %>). * Implemented alternate method of retrieving command schema result information in certain scenerios where it would fail otherwise. * Fixed bug with SQL7 and views. * Added option to installer to select whether or not VS.NET support is installed. * Made it so that Undo buffer is cleared right after document load. Build 2.2.4 (Beta): * Added GetProperties and GetRequiredProperties to CodeTemplate. * Added AllInputParameters, AllOutputParameters, and NonReturnValueParameters to the CommandSchema object. * Fixed various exceptions in CodeSmith Studio. * Added EngineSample (this was previously ConsoleSample). * Added ConsoleSamples. This contains various samples of using the command line client. * Added option to installer to include Visual Studio .NET 2003 support. * Made CodeSmith Studio handle saving to read-only files. * Fixed issue with command parameters extended properties. * Added new sample template that outputs all extended properties for a database. Build 2.2.3 (Beta): * Fixed parser bug where first literal line of template would be parsed incorrectly and discarded. * Fixed parser bug where