Skip to content

Getting Started

IlyaAI edited this page Apr 11, 2015 · 11 revisions

(v1.0.5)

Local Usage

  1. Just install AnFake into your solution via NuGet Package Manager Console:

PM> Install-Package AnFake


2. ...and run AnFake build (you can do this from any command line console):

PM> .\anf.cmd Build


The 'anf.cmd' is a simple batch file which calls 'packages/AnFake.x.y.z/bin/AnFake.exe'. This file generated by AnFake installation script in your solution root folder. Installation script also generates basic 'build.fsx' file, so you can start building you solution right after AnFake installation.

If you want to use AnFake just for local builds the steps above are enough. But the main advantage of AnFake is - it provides alternative to Microsoft 'Build Process Template'. You might use the same build script both locally and within Team Build, so you will never edit build workflows more.

## Team Build Usage

To enable TFS integration the following additional steps are necessary.

1. Setup Visual Studio tools:

PM> .\anf.cmd "[AnFakeExtras]/vs-setup.fsx" Tools


The command:

1. Copies AnFake binaries to 'AppData\Local\AnFake'.
1. Adds external tools into Visual Studio (see TOOLS menu).

2. Setup TFS build process template:

PM> .\anf.cmd "[AnFakeExtras]/vs-setup.fsx" BuildTemplate


The command:

1. Creates temporary TFS workspace 'AnFake.BuildTemplate.yyyymmdd.hhmmss' (where yyyymmdd.hhmmss is current date-time).
1. Downloads $/TeamProject/BuildProcessTemplates from your source control into temporary local folder.
1. Pends add of AnFakeTemplate.xaml and some support binaries.
1. Command DOES NOT commit changes. You should do this manually in a regular way (e.g. from Visual Studio).

3. Create build definition based on AnFakeTemplate.xaml

1. In Visual Studio open 'Team Explorer' pick 'Home' > 'Builds' > 'New Build Definition'

2. Pick 'Source settings' in left pane and remove all mappings except '$/TeamProject/ProductA/dev: $(SourceDir)'. AnFakeTemplate automatically creates all necessary mappings from '.workspace' file.

3. Pick 'Process' in left pane, then click 'Show details' in 'Build process template' section.

4. From 'Build process file' combo box select 'AnFakeTemplate.v2.xaml'.

   If do this for a _first time_ then you need to click 'New' button and enter '$/TeamProject/BuildProcessTemplates/AnFakeTemplate.v2.xaml' into 'Version control path' field, then click 'OK'. After that AnFakeTemplate.v2.xaml appears in combo box.

5. Fill out other desired build definition parameters (drop folder, agent tags, cleaning option and logging verbosity) as you do normally.

6. Save changes.

AnFakeTemplate creates workspace using mappings from '.workspace' file and gets sources. Then it restores solution-level packages, i.e. restores AnFake binaries. Finally, it invokes 'anf.cmd' which in turn calls AnFake.exe from appropriate 'packages' subfolder. All logging/tracing produced by build script is redirected to standard Team Build log in real-time so you can see progress in build detail window within Visual Studio.

### See Also

[[AnFake Convention]]

[[Managing TFS workspaces with AnFake]]

[[Quick Reference]]

[[Samples]]