Regenerating and Running Flit's sample Fluent Interfaces

In order to execute Flit against the provided samples, you will need:

Build it

Unzip the release and open the solution file (trunk\src\Flit\Flit.sln). Because Flit is a design-time system, it doesn't actually consist of any executables, so pressing F5 will be no use. Instead, just build the project (ctrl + shift + b).

Assuming this succeeds, you should now have Flit compiled. Look for Flit.dll in trunk\src\Flit\Flit\bin\Debug. There should also be Flit's dependency, Irony.dll in that directory (if it's not there, you might have Irony already in your GAC. Just make sure the T4 templates can find the Irony dll ok).

Help T4 find Flit

T4 needs to be able to find these dlls in order to run Flit's templates, so add a reference path to the Flit.Samples project pointing to the Flit Bin directory:

ReferencePaths.png

Note that you don't actually need to reference Flit from the samples project, because Flit is only a dependency at codegen-time. These reference paths are machine specific, the setting goes into your csproj.user file, which is not checked into source control, so it's ok to put machine-specific paths in here.

(Optional) Run the unit tests

Some people like to run the unit tests after they check out code. The Flit.Tests project contains all the TDD unit tests that helped write Flit. We've used NUnit, but a simple find & replace would convert that to MSUnit for you. There's some more tests in the Flit.Samples project, but these aren't intended to check the health of the Flit code so much as to just demonstrate what the samples can do. Think of them all as console projects that just demo a bit of code for you.

Look at the code the templates generated

Look for any .tt file in the Flit.samples project, and expand it to see the .g.cs file that it generated. If there's a Usage.cs file in the same directory, this will show you how that Fluent Interface is intended to be used.

Regenerate a template

You can either save a *.tt file to have Visual Studio regenerate the template for you, or press the "Transform all Templates" button to rerun them all:

Transform all templates.png

Tweak a source file

At this point, you might as well just start experimenting. Find one of the *.txt source files, open it up, and rename a transition (or something innocuous like that). Regenerate the template and see what happens! At the moment, the error messages you get if there's a syntax error in one of your source files aren't very helpful, so it might help to read up on the Parser if you get an error.

Are you ready to Build your own Fluent Interface?

Last edited Oct 18, 2009 at 7:55 PM by robfe, version 5

Comments

No comments yet.