Snippet Compiler
Jeff Key
August 22, 2003
Updated May 9, 2004 

Hello, this is the Snippet Compiler Version 1 page. A newer, version 2 perpetual beta is available here.

If you're like me, you probably have hundreds of Visual Studio solutions that consist of a few lines of code to test out something outside the scope of whatever you're currently working on.  Of course there's nothing wrong with that, but the time it takes to launch a new VS.NET, create the project and so on is just unnecessary.  Today one of the voices in my head said that it's easy enough to compile code using the framework, so why not do something about it, so I wrote this little thing.  (It then told me to eat lunch, which I dutifully did.)

Snippet Compiler leads a simple life.  Here are its features:

  • Compiles and runs single or multiple C#, VB.NET and ASP.NET snippets.
  • Optionally builds WinForm EXEs, console EXEs or DLLs.
  • The user can store a library of templates.  
  • Displays compile errors and warning, including wave lines in editor with error/warning tooltips.
  • IntelliSense for static members and method signatures, as well as constructor signatures. 
  • Imports VS.NET projects.
  • Conveniently sits in the notification area waiting to be useful.
  • Exports snippets to HTML/RTF.

Special thanks to Syncfusion for donating their excellent Edit control and the following for donating before we knew we'd get it for free: Niels Berglund, Darren Jefford, Ryan LaNeve, Jason Mark, Matt Hawley, Damon Ronco, Omar Shahine, Brenton House and Vasanth Dharmaraj.


Changes in v1.11

  • Added tooltip to editor tab pages to display full filename
  • Added Edit|Replace
  • New Syncfusion control fixes two reported bugs:
    • Horizontal scrollbar is now accurate
    • Previously, if a completion character was pressed while an IntelliSense textbox was visible and an valid item wasn't selected, any text after the preceding period was deleted.
  • Added "Export HTML to Clipboard"
  • References are validated before being used.
  • Fixed problem some people had where build was successful but they got null ref exception after build.
  • Minor additions/changes

Changes in v1.10

  • Added the ability to force the compiled snippet(s) to use a legacy runtime and Framework assemblies
  • Added C# compiler option "Allow unsafe code blocks" 
  • Added tooltip for errors/warnings in code 
  • Added syntax definition files so the user can change them manually 
  • Added Saved Snippets folder 
    • Now, when a user tries to save a file that was opened as a template (from the New menu), the file is not saved automatically in the Templates folder; the Save As dialog is shown with the Saved Snippets folder as the initial folder
    • The user may still save a file as a template, but must manually navigate to the templates folder to save
    • All files/folders in the Saved Snippets folder are shown in the Open menu
    • The Saved Snippets folder can be changed by the user in the Options dialog 
  • Added a proper References dialog 
  • XML documentation (which drives the verbose IntelliSense descriptions) is now loaded for every referenced assembly if it is available.
  • Added some helper methods to the default snippets 
  • Added compiler warnings to the "Errors" display 
  • Added intellisense for namespaces
  • Added notification area icon context menu to Open & Exit
  • Added workarounds for users running at 120 DPI experiencing GDI+ bug
  • Changed: Cleaning up all files created during session
  • Changed behavior of notification area icon: Double-click to open/set focus, right-click for context menu
  • Minor additions/changes/fixes

Changes in v1.9

  • Updated IntelliSense method info to mimic VS.NET ("<returnType> <type>.<member>(<arglist>)")
  • IntelliSense now shows all static methods, props and fields off of resolvable types (ie. things in the loaded Framework assemblies) 
  • IntelliSense for method and constructor signatures 
  • Added method, constructor descriptions for classes whose XML documentation is in the IntelliSense folder.
  • Added Lutz Roeder's CommandBar menu and toolbar
  • Added nesting to the New menu item so template snippets can be organized hierarchically via the file system. 
  • Added "Kill Process" option (only works when not redirecting output or starting via command prompt) 
  • Added aliasing so things like "int" and "integer" are handled properly by IntelliSense. Please let me know if I've missed any.
  • Added Save All
  • Added HTML and RTF export
  • Made VB.NET IntelliSense non-case-sensitive
  • Added option to create XML documentation for C# snippets
  • Added option strict, option explicit and compare binary options for VB.NET
  • Added Find, Find Next and Incremental Search (courtesy of the Syncfuson control)
  • Added high performance-timing templates
  • Added "View|Errors/Output" menu option. Pops up on compile errors or output if hidden. State is persisted between sessions
  • Added Find form
  • Added ability to compile (snippet or all) w/o writing to a file or running. This is useful for getting error messages while coding.
  • Added "Minimize to notification area" option. (Always did previously.)
  • Changed: When attempting to save a read-only file, the user is asked if they would like the read-only attribute removed and continue save
  • Changed: When doing a StartAll on a web project, all of the web snippets' names are retained and copied to the server. Previously only the current snippet was copied and given a generic name
  • Fixed: Got latest Syncfusion control which fixes the erratic intellisense listbox
  • Fixed: Cursor now goes to correct VB line containing error
  • Changed: Build|Current... and Build|All... are now Build|Current To File... and Build|All To File...
  • Changed: CTRL+Shift+B now compiles the current snippet w/o running/saving to file.
  • Lots of little things

September 16 Note

  • To slow down the frantic pace of releases, I've created a super-secret Snippet Compiler Beta workspace on GotDotNet.  I'll post interim builds there as well as keep a list of bugs, known issues, etc.  There's also a message board.

Changes in v1.8

  • Added Syncfusion Edit control (donated by Syncfusion. thanks!)
  • Syncfusion Edit control supports different fonts, so editor font settings have been re-enabled.
  • Added Visual Studio.NET project import (tested C# 2002 & 2003, VB 2003)
  • Added keyboard commands CTRL+K, CTRL+C for commenting and CTRL+K, CTRL+U for uncommenting a line or lines. 
  • Added IntelliSense for public static Console methods. (Proof of concept at this point; using reflection, but only against Console.)
  • Added Print and Print Preview
  • Added simple performance-timing template
  • Added error squiggles to VB.NET snippets
  • Made error squiggles more accurate
  • Added "Copy" context menu to errors listview to copy error text
  • Added option to [dis]enabled brace/param matching
  • Added "Show White Space" option
  • Added "Insert spaces for tabs" option
  • Added more IDE-like features but made them optional so those that wish to use Snippet Compiler as an IDE can, and those that do not are not bothered with them.
    • Added "Show asterisk when content changes"
    • Added "Prompt to save on close if modified"
  • Added drag-n-drop reordering of tabs
  • Added persistence of height of error/output panel between sessions
  • When the form is resized, error text column in listview is resized accordingly
  • Noticed Syncfusion textbox has a bunch of fun stuff on its context menu
  • Fixed: Filename in tab was always lower case
  • Fixed: Exception was thrown if templates folder wasn't where it was expected. User is now prompted to set the correct folder.
  • "Folding" has been renamed to "Outlining" to conform w/VS.NET and Syncfusion's control
  • Note: Automatic outlining (like VS.NET) isn't implemented in the Syncfusion control yet. You can manually outline blocks by selecting a block, right-clicking on it and choosing "Outlining|Hide Selection" (Outlining can be nested)

Changes in v1.7

  • Added projects so the user can save/open snippets en masse
  • Added "Build" menu so user can build Console exe/WinForms exe/DLL to a user-specified file
  • Added "Start as WinForm" and "Start All as WinForm". These will compile the snippets as a WinExe (so the console doesn't pop up first). 
  • Added Start Minimized option. 
  • Added Close All 
  • Added samples showing how to break into the debugger (and info in the help file) 
  • Noticed [Shift+]Ctrl+Tab now works.
  • Noticed the icon on non 32-bit displays looked really bad, so I added more color depths
  • Realized CompilerResults has an Errors property. Smacked head and removed RegExed error parsing.

Changes in v1.6

I think all of these were suggestions.  Thank you!

  • Added "Start All" command to compile all snippets and run 
  • Now using text editor from SharpDevelop
  • Added "Generate debug symblos" option (always did previously)
  • Now compiling from disk so if symbols are present and the debugger attaches to the process, the source is shown
  • Added single-page web snippets 
  • Added multi-snippet web pages so codebehinds and classes from other snippets can be used
  • Persisting the size of the main window 
  • Added server-side "form" tag to webforms 
  • Added Save/SaveAs/Close context menu to tab pages 
  • Added red error squiggles 
  • Made the templates folder user-definable 
  • Added option to show path in addition to filename on tab
  • Added multiselect to Open dialog so user can open more than one file at a time
  • Added horizontal scrollbar to editor 
  • Added Console.ReadLine() to both default console templates
  • Fixed problem where if a web root wasn't specified when an aspx snippet was run, an exception occurred
  • Fixed SaveAs so the tab's text reflects the new file name
  • Added Run From Command Prompt option 

Changes in v1.4

  • Added Save/SaveAs/Open 
  • Added independent font settings for editor, errors and output 
  • Added option to minimize to tray when close button is clicked
  • Turned off word wrapping and added horiz. scroll bar in output window
  • Changed VB ctor to New (oops!) 
  • Added Microsoft.VisualBasic imports to VB templates 

Changes in v1.3

  • Added VB support
  • Added default compiler option for unknown file types
  • CTRL+A selects all
  • Switching tabs sets focus to the editor
  • Default and CTRL+N templates are based on default compiler
  • Added an optional download that will force it to run on v1.0 of the framework.  (Requested by a couple people.)

Changes in v1.2

  • Added Console redirect to Output window option.

Changes in v1.1

  • Added References dialog + functionality
  • Turned off word wrap

Download NOTE: You must download and place the config file below in the exe's directory for it to work on .NET 1.0.
Check out Create Shortcut for easy installation.
Download Config (Place this file in the Snippet Compiler folder to make it run on v1.0 of the .NET Framework.)

Back to dotnet